当前位置:网站首页>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 :
边栏推荐
- VB. Net simple processing pictures, black and white (class library - 7)
- 724. 寻找数组的中心下标
- Unity2d -- character moves and turns
- Ping port artifact psping
- Solar insect killing system based on single chip microcomputer
- Online shrimp music will be closed in January next year. Netizens call No
- Design and implementation of tcp/ip series overview
- [MySQL practice of massive data with high concurrency, high performance and high availability -8] - transaction isolation mechanism of InnoDB
- 补某视频网站的js,进行视频解密
- ping端口神器psping
猜你喜欢

js如何将秒转换成时分秒显示
![[MySQL practice of massive data with high concurrency, high performance and high availability -8] - transaction isolation mechanism of InnoDB](/img/8e/90d08d22a2d340242be2357f662ea4.jpg)
[MySQL practice of massive data with high concurrency, high performance and high availability -8] - transaction isolation mechanism of InnoDB

如何展开Collapse 的所有折叠面板
![BUU-Crypto-[GXYCTF2019]CheckIn](/img/b8/ad6c05977f6943f30e9975acb6eb6e.jpg)
BUU-Crypto-[GXYCTF2019]CheckIn

云原生架构实战案例及优化解决方案

Integer type of C language

509. 斐波那契数、爬楼梯所有路径、爬楼梯最小花费

Simulink与Arduino串口通信

win10清除快速访问-不留下痕迹

Principle and practice of common defects in RSA encryption application
随机推荐
如何展开Collapse 的所有折叠面板
Steady! Huawei micro certification Huawei cloud computing service practice is stable!
Letter meaning and parameter abbreviation of optical module Daquan
Build an Internet of things infrared temperature measuring punch in machine with esp32 / rush to work after the Spring Festival? Baa, no matter how hard you work, you must take your temperature first
LM小型可编程控制器软件(基于CoDeSys)笔记二十一:错误3703
Google Chrome browser will support the function of selecting text translation
[Excel] 数据透视图
Recommended system 1 --- framework
Simulink与Arduino串口通信
win10清除快速访问-不留下痕迹
el-select如何实现懒加载(带搜索功能)
[interested reading] advantageous filtering modeling on long term user behavior sequences for click through rate pre
配置交叉编译工具链和环境变量
Introduction to AMBA
JS扁平化数形结构的数组
input显示当前选择的图片
Signification des lettres du module optique et abréviation des paramètres Daquan
Input displays the currently selected picture
flink1.13 sql基础语法(一)DDL、DML
LabVIEW错误对话框的出现