问题
在el-table中使用v-for时报错:“custom elements in iteration require v-bind:key”
原因
在vue新版本中,使用 v-for 迭代语法时,需要加入key值。
解决办法
<el-table
size="mini"
max-height="601"
border
highlight-current-row
:header-row-style="HeadRowStyle"
:header-cell-style="HeadCellStyle"
:cell-style="CellStyle"
:row-style="RowStyle"
:default-sort="{prop: 'name', order: 'ascending'}"
:data="tableData"
@sort-change="currSortChange"
@current-change="currRowchange">
<el-table-column v-for="(v,i) in col" :label="v.title" :prop="v.field" :key="i">
</el-table-column>
</el-table>