1、使用row-key和reserve-selection结合就能实现分页多选回显
<el-table
ref="table"
:data="tableData"
:header-cell-style="{'text-align': 'center'}"
:cell-style="{ 'text-align': 'center' }"
@selection-change="handleSelectionChange"
:row-key="getRowKeys">
<el-table-column type="selection" width="55" :reserve-selection="true">
</el-table-column>
</el-table>
data() {
return {
getRowKeys(row) {
return row.id;
},
selectedData: [],
};
},
methods:{
handleSelectionChange(rows){
this.selectedData = [];
if (rows) {
this.selectedData = rows.map(row => { return row.id })
}
}
}
2、清空选中的数据
this.$refs.table.clearSelection()