当前位置:网站首页>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 :
边栏推荐
- Recommended system 1 --- framework
- Thread pool: use thread pool to optimize query speed
- fastjson
- [Excel] 数据透视图
- Luogu deep foundation part 1 Introduction to language Chapter 5 array and data batch storage
- 2022 t elevator repair operation certificate examination question bank and simulation examination
- LM small programmable controller software (based on CoDeSys) note XXI: error 3703
- 总线的基本概念
- BUU-Real-[PHP]XXE
- VB.net 简单的处理图片,黑白(类库——7)
猜你喜欢

BUU-Reverse-easyre
![[paper summary] zero shot semantic segmentation](/img/78/ee64118d86a7e43ec4d1cb97191fbe.jpg)
[paper summary] zero shot semantic segmentation

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

Input displays the currently selected picture

如何展开Collapse 的所有折叠面板

Programmers don't talk about morality, and use multithreading for Heisi's girlfriend

数据标注是一块肥肉,盯上这块肉的不止中国丨曼孚科技

Void convolution, deformable convolution, deformable ROI pooling

VB.net 简单的处理图片,黑白(类库——7)

C语言简易学生管理系统(含源码)
随机推荐
SQL injection - injection based on MSSQL (SQL Server)
fastjson
力扣(LeetCode)184. 部门工资最高的员工(2022.07.03)
如何使用postman实现简单的接口关联【增删改查】
C # character similarity comparison general class
Zzulioj:1201: mode problem
Thinkphp6.0 middleware with limited access frequency think throttle
el-select如何实现懒加载(带搜索功能)
Integer type of C language
Arc135 C (the proof is not very clear)
Flask
Write a complete answer applet (including single choice questions, judgment questions and multiple topics) (III) single choice questions, judgment questions, and the first question display
2022 t elevator repair operation certificate examination question bank and simulation examination
[paper summary] zero shot semantic segmentation
[paper summary] zero shot semantic segmentation
How to configure static IP for Kali virtual machine
Etcd database source code analysis - initialization overview
Appearance of LabVIEW error dialog box
C语言简易学生管理系统(含源码)
BUU-Pwn-test_ your_ nc