作者:同亮uncle_847 | 来源:互联网 | 2022-03-10 23:34
本文实例为大家分享了vue实现列表的添加点击,供大家参考,具体内容如下
使用指令:v-on v-for v-on v-bind v-model
html
js
window.Onload= function() {
Vue.component("todo-item", {
props: ["todo"],
template: "
{{todo.text}}"
})
var app = new Vue({
el: '#app',
data: {
items: [
],
newitem: ''
},
methods: {
liClick: function (item) {
item.isFinish = !item.isFinish;
},
clickKey: function () {
this.items.push({
event: this.newitem,
isFinish: false
})
this.newitem = '';
}
}
});
}
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。