el-table表格选中行和回显行
环境:vue3+element-plus
选中行selection
<el-table ref="baseTableRef" row-key="id" border :selection="true" :reserve-selection="true" :data="dataList">
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column label="名称" prop="name" align="center" />
</el-table>
回显选中行
function init(){
nextTick(() => {
let row = dataList[0]; // 行数据
proxy.$refs.baseTableRef.toggleRowSelection(row, true);
});
}
拿到当前选中的行数据列表
proxy.$refs.baseScopeTableRef.getSelectionRows()