vue报错之Duplicate keys detected: '0'. This may cause an update error.

昨天运行vue项目的时候,出现了[Vue warn]: Duplicate keys detected: ‘0‘. This may cause an update error. 错误,检测到重复的key值。主要是写了两个for循环,我们在使用v-for的时候,都要加上一个必要的key值,然而又将key的值写成一样的了。

可以将其中一个的key修改一下即可。

 <div class="info1" v-for="(item, index) in itemList" :key="‘info1-‘+ index"></div>

 

文章来自:https://www.cnblogs.com/songForU/p/10551037.html
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3