1、你可以通过 selectable 属性来控制哪些行可以选择(显示多选框)
<el-table
:data="tableData"
row-key="id"
default-expand-all
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
@select="handleSelect"
@select-all="handleSelectAll">
<el-table-column
type="selection"
:selectable="checkSelectable"
width="55">
</el-table-column>
<!-- 其他列 -->
</el-table>
// 控制树形表格多选框的显示层级
function checkSelectable(row, index) {
return row.type == 'instance';
}
2、通过 css 隐藏被禁用的多选框
:deep(.el-table .el-table__row .el-checkbox .is-disabled) {
display: none;
}