当前位置:网站首页>How to get the parent node of all nodes in El tree
How to get the parent node of all nodes in El tree
2022-07-04 05:41:00 【_ Virgo programmer's daily life】
<el-tree ref="tree" :data="data" :props="defaultProps" @node-click="handleNodeClick"></el-tree>
<script>
import {
throttle } from 'lodash'
export default {
data() {
return {
data: [
{
label: ' Class A 1',
value: '1',
children: [{
label: ' second level 1-1',
value: '1-1',
children: [{
label: ' Level three 1-1-1',
value: '1-1-1'
}]
}]
}, {
label: ' Class A 2',
value: '1-2',
children: [{
label: ' second level 2-1',
value: '2-1',
children: [{
label: ' Level three 2-1-1',
value: '2-1-1'
}]
}, {
label: ' second level 2-2',
value: '2-2',
children: [{
label: ' Level three 2-2-1',
value: '2-1-1'
}]
}]
}, {
label: ' Class A 3',
value: '3',
children: [{
label: ' second level 3-1',
value: '3-1',
children: [{
label: ' Level three 3-1-1',
value: '3-1-1'
}]
}, {
label: ' second level 3-2',
value: '3-2',
children: [{
label: ' Level three 3-2-1',
value: '3-2-1'
}]
}]
}],
defaultProps: {
children: 'children',
label: 'label'
}
}
},
methods: {
handleNodeClick(data, node) {
// console.log("data How much is? ");
// console.log(node);
// let selectedNode = this.$refs.tree.getNode(node);
this.breadList =[]
this.platform(node);
console.log("value How much is? ");
console.log(this.breadList);
},
// Recursive function
platform(node) {
if (!node.parent) {
// If there is no parent node , Then return directly
return
}
this.breadList.unshift(node.data.value)// take value Save up
// Call recursion
this.platform(node.parent)
},
}
</script>
Click the third level to print the results as follows :
边栏推荐
- 2022年R2移动式压力容器充装复训题库及答案
- 如何获取el-tree中所有节点的父节点
- VB.net GIF(制作、拆解——优化代码,类库——5)
- 卸载Google Drive 硬盘-必须退出程序才能卸载
- c语言经典指针和数组笔试题解析
- 2022 question bank and answers for safety management personnel of hazardous chemical business units
- input显示当前选择的图片
- js arguments参数使用和详解
- flink1.13 sql基础语法(一)DDL、DML
- Actual cases and optimization solutions of cloud native architecture
猜你喜欢

LM小型可编程控制器软件(基于CoDeSys)笔记二十一:错误3703

Just do it with your hands 7 - * project construction details 2 - hook configuration

RSA加密应用常见缺陷的原理与实践

如何获取el-tree中所有节点的父节点

Topological sorting and graphical display of critical path

1480. 一维数组的动态和

JS扁平化数形结构的数组

19. Framebuffer application programming

Programmers don't talk about morality, and use multithreading for Heisi's girlfriend
![[wechat applet] template and configuration (wxml, wxss, global and page configuration, network data request)](/img/78/63ab1a8bb1b6e256cc740f3febe711.jpg)
[wechat applet] template and configuration (wxml, wxss, global and page configuration, network data request)
随机推荐
JS扁平化数形结构的数组
Online shrimp music will be closed in January next year. Netizens call No
Flink1.13 basic SQL syntax (II) join operation
1.1 history of Statistics
空洞卷积、可变形卷积、可变形ROI Pooling
flink1.13 sql基础语法(二)join操作
Supplement the JS of a video website to decrypt the video
left_and_right_net正常版本
2022 t elevator repair operation certificate examination question bank and simulation examination
Use of hutool Pinyin tool
Introduction to AMBA
Viewing and using binary log of MySQL
BUU-Real-[PHP]XXE
Notepad++ -- display related configurations
Etcd database source code analysis - initialization overview
JS string splicing enhancement
What are the reasons for the frequent high CPU of ECS?
简易零钱通
Character types of C language
VB.net GIF(制作、拆解——优化代码,类库——5)