el-table 判断expand显示
<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'
}
}
如果存在row-expand-cover则隐藏
/deep/ .el-table .row-expand-cover .cell .el-table__expand-icon {
display: none;
}