当前位置:网站首页>Processing of tree structure data
Processing of tree structure data
2022-07-03 01:49:00 【13 less】
When we do development , Sometimes let's deal with tree data . Today, let's talk about how to deal with tree data .
One . Two structures
(1) The back end returns a tree structure , This can be discussed with the backend .
(2) The back end returns a tiled structure , You need to convert through recursion .
Two . Passed element-ui Look at the tree structure .
Code :
<template>
<div class="">
<el-tree :data="data" :props="defaultProps" @node-click="handleNodeClick"></el-tree>
</div>
</template>
<script>
export default {
data() {
return {
data: [{
label: ' Class A 1',
children: [{
label: ' second level 1-1',
children: [{
label: ' Level three 1-1-1'
}]
}]
}, {
label: ' Class A 2',
children: [{
label: ' second level 2-1',
children: [{
label: ' Level three 2-1-1'
}]
}, {
label: ' second level 2-2',
children: [{
label: ' Level three 2-2-1'
}]
}]
}, {
label: ' Class A 3',
children: [{
label: ' second level 3-1',
children: [{
label: ' Level three 3-1-1'
}]
}, {
label: ' second level 3-2',
children: [{
label: ' Level three 3-2-1'
}]
}]
}],
defaultProps: {
children: 'children',
label: 'label'
}
};
},
methods: {
handleNodeClick(data) {
console.log(data);
}
}
};
</script>
<style scoped></style>
View :

Analysis of the structure :

Analyze this structure :
Class A : Nothing there? , only one label ' Class A 1'
second level : stay children Keep writing inside label
Level three : Behind the second level children.
Level Four :......
3、 ... and . The actual development

When adding new interface documents , Transfer to the upper layer id, Can be added .
The same goes for deleting .
边栏推荐
- leetcode刷题_两数之和 II - 输入有序数组
- Everything文件搜索工具
- 查询商品案例-页面渲染数据
- ¢ growth path and experience sharing of getting an offer
- Network security - talking about security threats
- C application interface development foundation - form control (1) - form form
- Some functions of applet development
- STM32 - GPIO input / output mode
- GDB 在嵌入式中的相关概念
- Caused by: com. fasterxml. jackson. databind. exc.MismatchedInputException: Cannot construct instance o
猜你喜欢

小程序开发的部分功能

Huakaiyun (Zhiyin) | virtual host: what is a virtual host

Wireshark data analysis and forensics a.pacapng

NCTF 2018 part Title WP (1)
![[data mining] task 1: distance calculation](/img/72/a63cdfe32a7c438acf48a069d9bba1.png)
[data mining] task 1: distance calculation

Everything文件搜索工具

STM32 - Application of external interrupt induction lamp

Rockchip3399 start auto load driver

【Camera专题】手把手撸一份驱动 到 点亮Camera

After reading this article, I will teach you to play with the penetration test target vulnhub - drivetingblues-9
随机推荐
Network security - scanning and password explosion 2
Three core issues of concurrent programming - "deep understanding of high concurrent programming"
"Jetpack - livedata parsing"
海量数据冷热分离方案与实践
Cloud native topic sorting (to be updated)
openresty 缓存
疫情当头,作为Leader如何进行团队的管理?| 社区征文
Huakaiyun | virtual host: IP, subnet mask, gateway, default gateway
Common English Vocabulary
Openresty cache
Network security - vulnerabilities and Trojans
简易分析fgui依赖关系工具
[fluent] hero animation (hero animation use process | create hero animation core components | create source page | create destination page | page Jump)
网络安全-漏洞与木马
C application interface development foundation - form control (3) - file control
數學知識:臺階-Nim遊戲—博弈論
英语常用词汇
QTableWidget懒加载剩内存,不卡!
Network security - Information Collection
网络安全-密码破解