HTML
<el-table :row-class-name="getRowClass"></el-table>
JS
getRowClass(row, rowIndex){
// 判断当前行是否有子数据
if(row.row.children === null || row.row.children === undefined || row.row.children.length === 0){
return 'row-hidden-expand-icon'
}
}
CSS
.row-hidden-expand-icon{
td{
&:first-child{
.el-icon{
visibility: hidden;
}
}
.el-table__expand-icon{
pointer-events: none;
}
}
}
网友评论