<th v-for="value in tableColumn" :key="value"></th>
<tr style="border: 1px solid red;" v-for="(value, key3) in tableRows" :key="value">
<td class="td-center">{{rowsName[key3]}}</td>
<td v-for="value in tableColumn" :key="value" class="table-td cursor-pointer" @click="imgClick()">
<img class="img-radius-50" src="../../static/test.png">
</td>
</tr>
上面代码会出现 [Vue warn]: Duplicate keys detected: '1'. This may cause an update error.
错误,key
属性冲突导致
解决方案
1.删除整行代码 <th v-for="value in tableColumn" :key="value"></th>
2.将 <th v-for="value in tableColumn" :key="value"></th>
修改为 <th v-for="value in tableColumn" :key="value + '-label'"></th>