1.templatetemplate里面对应的代码:
<el-table :data="menuList" style="width: 100%" :row-class-name="isShowIcon">
<el-table-column type="expand">
<template slot-scope="props" v-if="props.row.menuList">
<el-table :data="props.row.menuList" :row-class-name="isShowIcon" :show-header=false>
<el-table-column label="菜单名称" prop="menuName"></el-table-column>
<el-table-column label="请求地址" prop="url"></el-table-column>
<el-table-column label="可见" prop="isHide"></el-table-column>
</el-table>
</template>
</el-table-column>
<el-table-column label="菜单名称" prop="menuName"></el-table-column>
<el-table-column label="请求地址" prop="url"></el-table-column>
<el-table-column label="可见" prop="isHide"></el-table-column>
</el-table>
2.style里面对应的代码:
.hiderow .el-table__expand-column .el-icon {
visibility: hidden;
}
3.script里面对应的代码:
methods:{
isShowIcon(row, index){
if(row.row.menuList != null)
return ''
else
return 'hiderow'
},
这个样子就可以了哦
注意:重点说一下css样式这里
**.hiderow .el-table__expand-column .el-icon {
visibility: hidden;
}**
这里如果层级不够是不会起作用的,而且要强调的是要加css
穿透属性::v-deep
正确的是:
::v-deep .hiderow .el-table__expand-column .cell .el-icon {
visibility: hidden;
}