Skip to content

Commit 81de5d4

Browse files
robertbenjaminchrisvfritz
authored andcommitted
Use index as the key in todo list example (#998)
If the todo content is used as the key, there will be issues if a user enters multiple todos with the same content. Using the index ensures that all keys are unique.
1 parent 75d9525 commit 81de5d4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/v2/guide/list.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ new Vue({
298298
<li
299299
is="todo-item"
300300
v-for="(todo, index) in todos"
301-
v-bind:key="todo"
301+
v-bind:key="index"
302302
v-bind:title="todo"
303303
v-on:remove="todos.splice(index, 1)"
304304
></li>

0 commit comments

Comments
 (0)