Skip to content

Commit dc72efb

Browse files
Alex-Sokolovkazupon
authored andcommitted
list.md add note about key in v-for with components (vuejs#792)
1 parent b0f9d57 commit dc72efb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/v2/guide/list.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,11 @@ new Vue({ el: '#range' })
218218
You can directly use `v-for` on a custom component, like any normal element:
219219

220220
``` html
221-
<my-component v-for="item in items"></my-component>
221+
<my-component v-for="item in items" :key="item.id"></my-component>
222222
```
223223

224+
> In 2.2.0+, when using `v-for` with a component, a [`key`](list.html#key) is now required.
225+
224226
However, this won't automatically pass any data to the component, because components have isolated scopes of their own. In order to pass the iterated data into the component, we should also use props:
225227

226228
``` html

0 commit comments

Comments
 (0)