当前位置:网站首页>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 .
边栏推荐
- PS去除水印详解
- C application interface development foundation - form control (1) - form form
- Network security - scan
- [Appendix 6 Application of reflection] Application of reflection: dynamic agent
- [leetcode] 797 and 1189 (basis of graph theory)
- Learn the five skills you need to master in cloud computing application development
- Leetcode skimming questions_ Sum of two numbers II - enter an ordered array
- NCTF 2018 part Title WP (1)
- 网络安全-NAT网络地址转换
- 【数据挖掘】任务3:决策树分类
猜你喜欢
Why is it not recommended to use BeanUtils in production?
Telecom Customer Churn Prediction challenge
STM32 - GPIO input / output mode
【数据挖掘】任务6:DBSCAN聚类
After reading this article, I will teach you to play with the penetration test target vulnhub - drivetingblues-9
Analysis, use and extension of open source API gateway apisex
mysql
C application interface development foundation - form control (3) - file control
Three core issues of concurrent programming - "deep understanding of high concurrent programming"
Leetcode skimming questions_ Sum of two numbers II - enter an ordered array
随机推荐
小程序开发黑马购物商城中遇到的问题
Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance o
Network security - Trojan horse
[shutter] animation animation (basic process of shutter animation | create animation controller | create animation | set value listener | set state listener | use animation values in layout | animatio
网络安全-木马
[untitled]
ByteDance data Lake integration practice based on Hudi
Network security - dynamic routing protocol rip
[error record] an error is reported in the fluent interface (no mediaquery widget ancestor found. | scaffold widgets require a mediaquery)
View of MySQL
【数据挖掘】任务4:20Newsgroups聚类
Uniapp component -uni notice bar notice bar
音程的知识的总结
7-25 read numbers (loop switch)
After reading this article, I will teach you to play with the penetration test target vulnhub - drivetingblues-9
One of the C language practical projects is greedy snake
【數據挖掘】任務6:DBSCAN聚類
STM32 - vibration sensor control relay on
Openresty cache
网络安全-扫描与密码爆破2