之前只实现了不显示小箭头,但是后来发现还是可以点击展开,这次更新实现了不显示,且点击无效,在此记录
<el-table
:data="dataList" border
ref="topicTable"
:default-expand-all="false" //所有子菜单是否展开
:row-class-name="getRowClass">//获取每一行的信息
@expand-change="handledetail"//控制是否可以点击展开
</el-table>
//对小箭头做了隐藏
getRowClass:function(row,rowIndex){
console.log(row)
console.log(row.row.orderChildEntities)
console.log(typeof(row.row.orderChildEntities))
if(row.row.orderChildEntities===null){ //判断当前行是否有子数据
return 'row-expand-cover'
}
},
//之前做了隐藏 ,但是还是可以点击展开下级的,加此方法屏蔽点击展开功能
handledetail(row,expandedRows){
if(row.orderChildEntities==null){
this.$refs.topicTable.toggleRowExpansion(row,false)
}
},
<style>
.row-expand-cover td:first-child .el-icon-arrow-right{visibility: hidden;}
</style>
刚开始写的时候一直实现不了,总以为是没有精确找到样式位置,后来把style里的scoped属性去掉就好了