Skip to content

Commit 7b9f5d7

Browse files
gsmnvphanan
authored andcommitted
Specify which types are allowed as values for 'key' of 'v-for' (#1900)
[List Rendering](https://vuejs.org/v2/guide/list.html#key) guide doesn't mention what types of values user can supply for `key` of `v-for`. There is a console warning for this already but it's hard to point people to it. This pull request fixes the issue.
1 parent d9c5695 commit 7b9f5d7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/v2/guide/list.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,8 @@ It is recommended to provide a `key` with `v-for` whenever possible, unless the
233233

234234
Since it's a generic mechanism for Vue to identify nodes, the `key` also has other uses that are not specifically tied to `v-for`, as we will see later in the guide.
235235

236+
<p class="tip">Don't use non-primitive values like objects and arrays as `v-for` keys. Use string or numeric values instead.</p>
237+
236238
## Array Change Detection
237239

238240
### Mutation Methods

0 commit comments

Comments
 (0)