实现效果
实现
<el-button type="primary" @click="toggleRowExpansion(true)" icon="el-icon-arrow-down" size="mini">全部展开</el-button>
<el-button type="primary" @click="toggleRowExpansion(false)" icon="el-icon-arrow-up" size="mini">全部收回</el-button>
toggleRowExpansion(isExpansion){
this.toggleRowExpansion_forAll(this.tableData,isExpansion);
},
toggleRowExpansion_forAll(data,isExpansion){
data.forEach(item=>{
this.$refs.dataTreeList.toggleRowExpansion(item,isExpansion);
if(item.children != undefined && item.children != null){
this.toggleRowExpansion_forAll(item.children,isExpansion);
}
})
}