<el-tree
:data="dataTree"
show-checkbox
:default-expand-all="false"
:check-strictly="true"
node-key="label"
ref="tree"
highlight-current
accordion
@node-click="handleNodeClick"
@check="handleCheck"
:props="defaultProps">
</el-tree>
handleNodeClick(data,node){ // 节点的点击事件
console.log('tree', data);
console.log('tree', node);
window.localStorage.setItem("node", node);
if (node.checked === true) { // 当树被选中时
}
}
handleCheck(nodes, resolve) {
//nodes节点所对应的对象;resolve选中状态对象
if (resolve.checkedKeys.length > 0) {
this.$refs.tree.setCheckedKeys([nodes.label]);
}
},