添加ref属性
<el-table
ref="tableRef"
border
row-key="id"
v-loading="loading"
:data="orgList"
@selection-change="handleSelectionChange"
>
默认全选
proxy.$nextTick(function () {
// 设置表格所有行全部选中
proxy.$refs.tableRef.toggleAllSelection()
})
默认选中某行数据
proxy.$nextTick(function () {
for (let i=0;i<orgList.value.length;i++)
{
proxy.$refs.tableRef.toggleRowSelection(orgList.value[i], true)
}
}
)