<el-table
border
:data="tableData"
ref="multipleTable"
v-loading="tableLoading"
:row-key="(row)=>{ return row.personId}"
:cell-style="yellowBg"
@selection-change="handleSelectionChange"
:header-cell-style="{ 'text-align': 'center' }"
>
<el-table-column
fixed
type="selection"
width="55"
:reserve-selection="true"
>
</el-table-column>
</el-table>
重点是:
:row-key="(row)=>{ return row.classId}"
:reserve-selection="true"
重置时清空选项: this.$refs.multipleTable.clearSelection();
选中的数据 :this.$refs.multipleTable.toggleRowSelection(this.list[index]);
//必须传表格的数据;以数组[下标]格式传递