ElementUI 表格展开的属性 type=“expand”
2021-08-02 本文已影响0人
Cherry丶小丸子
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;
}
}
}