vue项目中报了一个这样的错:Duplicate keys detected: 'C1812170006'. This may cause an update error.

vue控制台报错Duplicate keys detected: 'xxxx'. This may cause an update error.解决方案

虽然不影响使用,但是报错还是得解决的

只要一进入该页面,就会出这个红色的错误,网上查了资料,说是v-for循环里,key值可能重复了,所以会报这个错。

查看了下,页面果然有v-for循环

vue控制台报错Duplicate keys detected: 'xxxx'. This may cause an update error.解决方案

key值是必须唯一的,如果重复就会报错
可以把key值改为index(其实就是用索引做key值),就可以避免这个情况:

vue控制台报错Duplicate keys detected: 'xxxx'. This may cause an update error.解决方案

 

相关文章:

  • 2022-12-23
  • 2021-12-31
  • 2022-12-23
  • 2022-01-08
  • 2021-06-12
  • 2021-12-11
猜你喜欢
  • 2021-11-26
  • 2022-12-23
  • 2021-10-21
  • 2021-08-02
  • 2021-11-20
  • 2021-04-05
相关资源
相似解决方案