效果图
1、取消父子关联+开启表头权限
:checkbox-config="{ checkStrictly: true, showHeader: true }"
2、全选和下面单选的联动
@checkbox-all="checkALL"
@checkbox-change="checkChange"
//全选
checkALL({ checked }) {
for (var row of this.tableData) {
this.$refs.xTree.setCheckboxRow(row, checked);
}
},
//其他勾选事件
checkChange() {
var checkCount = this.$refs.xTree.getCheckboxRecords(true).length;
if (checkCount == this.tableData.length) {
this.$refs.xTree.setAllCheckboxRow(true);
} else {
this.$refs.xTree.setAllCheckboxRow(false);
}
},
3、默认页面加载全选按钮去掉勾选
//全选框状态
this.$refs.xTree.setAllCheckboxRow(false);