父级表格设置属性 :row-class-name="getRowClass"
<el-table
:data="tableData"
:row-class-name="getRowClass">
<el-table-column type="expand">
<template slot-scope="props">
...
</template>
</el-table-column>
...
</el-table>
// 判断表格是否有子项,无子项不显示展开按钮
getRowClass (row, rowIndex) {
// children 是你子项的数组 key
if (row.row.children.length === 0) {
return 'row-expand-cover'
}
}
/deep/ .el-table .row-expand-cover .cell .el-table__expand-icon {
display: none;
}