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

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

vue项目中在使用el-tree组件时报了一个这样的错:
== Duplicate keys detected: '106002. This may cause an update error.==


不影响使用,但我个人,不太喜欢报红,也是为了避免能够多学习点东西

百度之后 说是 == v-for == 循环的时候key值重复了,但是我用的是el-tree 组件,然后我发现,是我的node-key和我children的id冲突了,然后换一个就可以了
代码修改前:
修改后代码:

** 注意 :**
key值必须是唯一的,可以不为id也可是其它的一些值,例如index下标之类的,但是,必须是唯一的

你可能感兴趣的:(日常报错,elementui,vue,js,css)