Vue v-for 的反面教材。

来源:互联网 发布:闲鱼怎么换淘宝账号 编辑:程序博客网 时间:2024/05/19 08:01
     <div id = "todo-list-example">
<input v-model ='newTodoText' v-on:keyup.enter='addNewTodo' placeholder ='Add a todo'>
<ul>
<li
is = "todo-item"
v-for="(todo,index)in todos"
v-bind:key ="todo.id"
v-bind:title ="todo.title"
v-on:remove ="todos.splice(index,1)">


</ul>

</div>


Vue.js 中v-for的用法,注意 in 的左右必须有空格,不然会报错!

原创粉丝点击