点击父节点,获取该节点的id,然后渲染成子节点,
目前id已获取,子节点数据也请求到了,不知道怎么渲染到该节点下面
看官方介绍有一个load参数--加载子树数据的方法,有没有用过的同志来指导一下怎么用
<el-tree
:props="props1"
:load="loadNode1"
node-key="id"
ref="tree"
highlight-current
lazy
show-checkbox
@node-click="handleNodeClick">
</el-tree>
loadNode(node, resolve){
console.log(node);
// if (node.level === 0) {
// return resolve([{ name: 'region' }]);
// }
// if (node.level > 1) return resolve([]);
// setTimeout(() => {
// const data = [];
//
// resolve(data);
// }, 500);
},
getClickchild(id) {
alert(id)
axios.get('/api/bank/oprtion/oprtionList.do?id='+id)
.then(function(res) {
console.log(res.data)
loadNode
})
.catch(function(error) {
console.log(error)
})
},
handleNodeClick(data) {
// this.clickId = data.id
console.log(data.id);
this.getClickchild(data.id)
}}
html:
data:
js: