没有特别多的数据
<template>
<el-tree
:props="props"
:load="loadNode"
lazy
show-checkbox>
</el-tree>
</template>
<script>
export default {
data() {
return {
props: {
label: 'name',
children: 'zones',
isLeaf:"leaf",//关键
},
isLeaf:"",
};
},
methods: {
loadNode(node, resolve) {
this.isLeaf = node.isLeaf;
console.log(node,"nodeeeee");
if (node.level === 0) {
return resolve([{ name: 'region' }]);
}
if (node.level > 1) return resolve([]);
setTimeout(() => {
const data = [{
name: 'leaf',
leaf: true,//这个是控制箭头是否显示和不显示的,只要leaf为true那就证明没有子节点
//了,所以就不展示了icon箭头了
}, {
name: 'zone'
}];
resolve(data);
}, 500);
}
}
};
</script>
希望对你有帮助