vue常见问题解决办法(二)|warning:component lists rendered with v-for should have explicit keys
命令行warning(Emitted value instead of an instance of Error)。component lists rendered with v-for should have explicit keys。See https://vuejs.org/guide/list.html#key for more info.截图如下:这里只是推荐使用key.
·
命令行warning(Emitted value instead of an instance of Error)。component lists rendered with v-for should have explicit keys。See https://vuejs.org/guide/list.html#key for more info.
截图如下:
这里只是推荐使用key.
原本的代码如下:
<el-tag
v-for = "feiLei of ruleForm.fenLeis"
:closable = "true"
type = "primary"
@close = "handleCloseFenLei(feiLei)">{{feiLei.name}}
</el-tag>
运行时显示warning,添加:key即可,如下:
<el-tag
v-for = "feiLei of ruleForm.fenLeis"
:key="feiLei1"
:closable = "true"
type = "primary"
@close = "handleCloseFenLei(feiLei)">{{feiLei.name}}
</el-tag>
这样就不会报错啦,具体看文档,key不是必须的,仅仅是warning
更多推荐
已为社区贡献3条内容
所有评论(0)