当前位置:网站首页>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 .
边栏推荐
- Mathematical knowledge: step Nim game game game theory
- 并发编程的三大核心问题 -《深入理解高并发编程》
- Smart management of Green Cities: Digital twin underground integrated pipe gallery platform
- What is tone. Diao's story
- Everything文件搜索工具
- 网络安全-防火墙
- NCTF 2018 part Title WP (1)
- Network security NAT network address translation
- Custom components, using NPM packages, global data sharing, subcontracting
- [data mining] task 5: k-means/dbscan clustering: double square
猜你喜欢

Telecom Customer Churn Prediction challenge

【Camera专题】Camera dtsi 完全解析

Some functions of applet development

Smart management of Green Cities: Digital twin underground integrated pipe gallery platform

【数据挖掘】任务5:K-means/DBSCAN聚类:双层正方形

Qtablewidget lazy load remaining memory, no card!

Take you ten days to easily complete the go micro service series (I)

【Camera专题】OTP数据如何保存在自定义节点中

mysql

7-25 read numbers (loop switch)
随机推荐
Mathematical Knowledge: Steps - Nim Games - Game Theory
云原生题目整理(待更新)
[data mining] task 5: k-means/dbscan clustering: double square
[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
[error record] navigator operation requested with a context that does not include a naviga
openresty 缓存
PS去除水印详解
[data mining] task 1: distance calculation
View of MySQL
传输层 TCP主要特点和TCP连接
Some functions of applet development
自定义组件、使用npm包、全局数据共享、分包
转载收录6.5大侠写的部分Qt开发经验
Caused by: com. fasterxml. jackson. databind. exc.MismatchedInputException: Cannot construct instance o
Network security - vulnerabilities and Trojans
High resolution network (Part 1): Principle Analysis
Network security - dynamic routing protocol rip
Common English Vocabulary
网络安全-木马
Summary of interval knowledge