Element-UI中el-tree的使用,Vue实现左树右表
element
A Vue.js 2.0 UI Toolkit for Web
项目地址:https://gitcode.com/gh_mirrors/eleme/element

·
页面如下:
Vue中结构如下:
treeData:
loadTree() {
getTree().then(response => {
console.log(response.data, 'data')
this.treeData = JSON.parse(JSON.stringify(response.data))
})
},
treeData结构如下:
具体如何组装treeData见上一篇博文
handleNodeClick 点击树方法实现
handleNodeClick(obj, node, data) {
this.isEdit = true
let flag = node.isLeaf
this.depth = obj.cateDepth
if (flag && this.depth == 3) {
this.isEdit = false
return
}
this.selectedNode = node.key
this.listQuery.parentId = obj.id
this.selectTreeData = obj;
console.log(this.selectTreeData, 'selectdata')
this.getMainList()
console.log(data);
}
其中参数obj为返回的数据对象,node.isLeaf为是否叶子节点,其他的是业务逻辑
一点点积累,加油鸭QAQ!




A Vue.js 2.0 UI Toolkit for Web
最近提交(Master分支:6 个月前 )
c345bb45
10 个月前
a07f3a59
* Update transition.md
* Update table.md
* Update transition.md
* Update table.md
* Update transition.md
* Update table.md
* Update table.md
* Update transition.md
* Update popover.md 10 个月前
更多推荐
所有评论(0)