在vue2.0+element-ui时的v-for  报了一个这样错误:

(Emitted value instead of an instance of Error) <el-tag v-for="tag in getHasRoles(scope.row.superrole)">: component lists rendered with v-for should have explicit keys.


意思是在说,组件列表呈现v-for渲染时,应该有明确的keys。在前面你用到了v-for="(item,index) in data",但是你没有明确:keys,且这个keys应该是唯一的。所以  在组件上 加上“:keys=‘index’”即可。希望可以帮到您。

 
<el-tag margin-right="5px" size="mini" v-for="(tag,index) in getHasRoles(scope.row.superrole)" :type="tag.summary" :key="index">

Logo

前往低代码交流专区

更多推荐