您能否告诉我如何在按钮点击时将项目添加到列表中。这是我的代码
https://plnkr.co/edit/hVQKk3Wl9DF3aNx0hs88?p=preview
var AddTODO = Vue.extend({
template: '#add-todo',
props: ['m'],
data: function () {
return {
message: ''
}
},
methods: {
addTodo: function () {
console.log(this.message)
console.log(this.m);
//this.m =this.message;
},
},
});
<template id="add-todo">
<div>
<input type="text" v-model="m">
<button @click="addTodo">Add todo</button>
</div>
</template>
有没有办法添加项目