vue 报错解决:component lists rendered with v-for should have explicit keys.
使用iview时控制台遇到的告警信息:: component lists rendered with v-for should have explicit keys. See https://vuejs.org/guide/list.html#key for more info.@ ./src/components/VideoManage/StickersNew.vue 7:0-374 ...
·
使用iview时控制台遇到的告警信息:
: component lists rendered with v-for should have explicit keys. See https://vuejs.org/guide/list.html#key for more info.
@ ./src/components/VideoManage/StickersNew.vue 7:0-374
原本的代码如下:
<Col span="2">
<Select placeholder="请选择国家" v-model="area">
<Option v-for="(area, key) in areaCountry" :value="key">{{ area.desc }}</Option>
</Select>
</Col>
运行时显示warning,添加:key即可,如下
<Col span="2">
<Select placeholder="请选择国家" v-model="area">
<Option v-for="(area, key) in areaCountry" :value="key" :key="area.desc">{{ area.desc }}</Option>
</Select>
</Col>
更多推荐
已为社区贡献3条内容
所有评论(0)