当前位置:网站首页>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 :
边栏推荐
- left_and_right_net正常版本
- 2022年R2移动式压力容器充装复训题库及答案
- Design and implementation of tcp/ip series overview
- Void convolution, deformable convolution, deformable ROI pooling
- 如何展开Collapse 的所有折叠面板
- Wechat applet +php realizes authorized login
- Actual cases and optimization solutions of cloud native architecture
- Introduction to AMBA
- Integer type of C language
- 接地继电器DD-1/60
猜你喜欢
Overview of relevant subclasses of beanfactorypostprocessor and beanpostprocessor
1480. Dynamic sum of one-dimensional array
[wechat applet] template and configuration (wxml, wxss, global and page configuration, network data request)
Ping port artifact psping
What is MQ?
HMS v1.0 appointment.php editid参数 SQL注入漏洞(CVE-2022-25491)
(4) Canal multi instance use
如何获取el-tree中所有节点的父节点
[paper summary] zero shot semantic segmentation
transformer坑了多少算力
随机推荐
19.Frambuffer应用编程
How to use postman to realize simple interface Association [add, delete, modify and query]
2022年A特种设备相关管理(电梯)考试题模拟考试平台操作
BUU-Pwn-test_ your_ nc
2022 t elevator repair operation certificate examination question bank and simulation examination
Nodejs learning document
云原生架构实战案例及优化解决方案
FreeRTOS 中 RISC-V-Qemu-virt_GCC 的 锁机制 分析
Void convolution, deformable convolution, deformable ROI pooling
Appearance of LabVIEW error dialog box
Kubernets first meeting
VB.net 调用FFmpeg简单处理视频(类库——6)
Accidentally deleted the data file of Clickhouse, can it be restored?
[Excel] 数据透视图
ANSYS command
How much computing power does transformer have
C language simple student management system (including source code)
VB. Net GIF (making and disassembling - optimizing code, class library - 5)
BUU-Reverse-easyre
XII Golang others