解决方案:给row-key值绑定一个唯一值
行数据的 Key,用来优化 Table 的渲染;在使用 reserve-selection 功能与显示树形数据时,该属性是必填的。类型为 String 时,支持多层访问:user.info.id
,但不支持 user.info[0].id
,此种情况请使用 Function
。
<el-table
ref="multipleTable"
:data="tableData"
tooltip-effect="dark"
style="width: 100%"
row-key="id"
@selection-change="handleSelectionChange">
</el-table>
data () {
return {
tableData: [
{
id: 1,
address: 'A'
},
{
id: 2,
address: 'B'
},
]
}
}
methods: {
handleSelectionChange(val) {
this.multipleSelection = val;
}
}