Element: [Bug Report] [email protected] 增加了v-for丢失key的警告,是否可将文档中的key都加上以消除警告?

Created on 11 Apr 2017  ·  2Comments  ·  Source: ElemeFE/element

Element UI version

1.2.8

OS/Browsers version

osx/terminal

Vue version

2.2.x

Reproduction Link

terminall.jsfiddle

Steps to reproduce

下面是一个警告的栗子:

WARNING in ./~/vue-loader/lib/template-compiler?{"id":"data-v-568c4395"}!./~/vue-loader/lib/selector.js?type=template&index=0!./~/vue-markdown-loader/_cache/tag-1.vue
(Emitted value instead of an instance of Error) <el-tag v-for="tag in tags">: component lists rendered with v-for should have explicit keys. See https://vuejs.org/guide/list.html#key for
more info.
 @ ./~/vue-loader!./~/vue-markdown-loader/_cache/tag-1.vue 9:2-152

What is Expected?

消除警告

What is actually happening?

存在大量警告,影响开发体验

Most helpful comment

这是你自己写的代码让别人怎么加.
<el-tag v-for="tag in tags">
=>
<el-tag v-for="(tag, index) in tags" :key="index">

All 2 comments

这是你自己写的代码让别人怎么加.
<el-tag v-for="tag in tags">
=>
<el-tag v-for="(tag, index) in tags" :key="index">

不会影响到开发体验吧,自己在开发的时候加上就好了,目前只是文档页会有提示。如果愿意的话可以给我们提 PR。

Was this page helpful?
0 / 5 - 0 ratings