当前位置:网站首页>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 .
边栏推荐
- High resolution network (Part 1): Principle Analysis
- 简易分析fgui依赖关系工具
- 疫情当头,作为Leader如何进行团队的管理?| 社区征文
- Huakaiyun | virtual host: IP, subnet mask, gateway, default gateway
- STM32 - Application of external interrupt induction lamp
- How to refresh the opening amount of Oracle ERP
- [fluent] hero animation (hero animation use process | create hero animation core components | create source page | create destination page | page Jump)
- Pytest learning notes (12) -allure feature · @allure Step () and allure attach
- Analysis, use and extension of open source API gateway apisex
- Network security - DNS spoofing and phishing websites
猜你喜欢
mysql
What is tone. Diao's story
Sweet talk generator, regular greeting email machine... Open source programmers pay too much for this Valentine's day
电信客户流失预测挑战赛
Analysis, use and extension of open source API gateway apisex
Force buckle 204 Count prime
查询商品案例-页面渲染数据
自定义组件、使用npm包、全局数据共享、分包
High resolution network (Part 1): Principle Analysis
【QT】自定义控件的封装
随机推荐
Caused by: com. fasterxml. jackson. databind. exc.MismatchedInputException: Cannot construct instance o
Qtablewidget lazy load remaining memory, no card!
网络安全-动态路由协议RIP
Scheme and practice of cold and hot separation of massive data
ByteDance data Lake integration practice based on Hudi
Network security ACL access control list
电信客户流失预测挑战赛
[untitled]
STM32 - GPIO input / output mode
Why is it not recommended to use BeanUtils in production?
Network security - talking about security threats
[keil5 debugging] debug is stuck in reset_ Handler solution
LeetCode 987. Vertical order transverse of a binary tree - Binary Tree Series Question 7
C语言课程信息管理系统
Mathematical knowledge: divisible number inclusion exclusion principle
Network security - man in the middle attack
技术大佬准备就绪,话题C位由你决定
VIM 9.0 is officially released! The execution speed of the new script can be increased by up to 100 times
The thread reuse problem of PageHelper using ThreadLocal, did you use it correctly?
网络安全-钓鱼