diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2018-02-28 18:28:31 +0000 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2018-02-28 18:32:04 +0000 |
commit | d7b3a71119eefa1dc84e75f91676bad3e2f386f8 (patch) | |
tree | 34845476d657fa55f95ed3b849cfed0c5c45fd4d | |
parent | 524c3c882852565bc73397df59fb30d0a95822fc (diff) | |
download | gitlab-ce-d7b3a71119eefa1dc84e75f91676bad3e2f386f8.tar.gz |
Adds information about nested v-for
-rw-r--r-- | doc/development/fe_guide/style_guide_js.md | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/doc/development/fe_guide/style_guide_js.md b/doc/development/fe_guide/style_guide_js.md index 634b19c728b..eec1e6122b3 100644 --- a/doc/development/fe_guide/style_guide_js.md +++ b/doc/development/fe_guide/style_guide_js.md @@ -586,6 +586,24 @@ When using `v-for` you need to provide a *unique* `:key` attribute for each item </template> ``` +1. When dealing with nested `v-for` use the same guidelines as above. + ```html + <div + v-for="item in items" + :key="item.id" + > + <span + v-for="element in array" + :key="element.id" + > + <!-- content --> + </span> + </div> + ``` + * Do not reuse the parent `:key` in the nested `v-for` + + + Useful links: 1. [`key`](https://vuejs.org/v2/guide/list.html#key) 1. [Vue Style Guide: Keyed v-for](https://vuejs.org/v2/style-guide/#Keyed-v-for-essential ) |