<el-tree
ref="selectTree"
class="Treecss"
:data="editableTabs"
node-key="id"
:props="{value: 'id',label: 'name', children: 'childTreeList',}"
:show-checkbox="true"
:default-checked-keys="[id]"
:check-strictly="true"
:check-on-click-node="true"
@check="handleCheckChange">
</el-tree>
//弹窗选中库,node 该节点所对应的对象、list 树目前的选中状态对象
handleCheckChange(node,list){
this.id=node.id;
//选中事件在选中后执行,当lis中有两个选中时,使用setCheckedKeys方法,选中一个节点
if (list.checkedKeys.length == 2) {
//单选实现
this.$refs.selectTree.setCheckedKeys([node.id]);
}
}