在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">