当前位置:网站首页>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 .
边栏推荐
- [shutter] animation animation (animatedbuilder animation use process | create animation controller | create animation | create components for animation | associate animation with components | animatio
- Everything file search tool
- CF1617B Madoka and the Elegant Gift、CF1654C Alice and the Cake、 CF1696C Fishingprince Plays With Arr
- 查询商品案例-页面渲染数据
- openresty 缓存
- Sweet talk generator, regular greeting email machine... Open source programmers pay too much for this Valentine's day
- Some functions of applet development
- ¢ growth path and experience sharing of getting an offer
- Qtablewidget lazy load remaining memory, no card!
- Why is it not recommended to use BeanUtils in production?
猜你喜欢
Sweet talk generator, regular greeting email machine... Open source programmers pay too much for this Valentine's day
自定义组件、使用npm包、全局数据共享、分包
Everything file search tool
Virtual list
[error record] the shutter component reports an error (no directionality widget found. | richtext widgets require a directionality)
传输层 TCP主要特点和TCP连接
7-25 read numbers (loop switch)
High resolution network (Part 1): Principle Analysis
Why can't the start method be called repeatedly? But the run method can?
小程序開發的部分功能
随机推荐
云原生题目整理(待更新)
Everything文件搜索工具
[机缘参悟-36]:鬼谷子-飞箝篇 - 面对捧杀与诱饵的防范之道
Introduction to flask tutorial
SSL flood attack of DDoS attack
[understanding of opportunity -36]: Guiguzi - flying clamp chapter - prevention against killing and bait
查询商品案例-页面渲染数据
【Camera专题】HAL层-addChannel和startChannel简析
Wordinsert formula /endnote
After reading this article, I will teach you to play with the penetration test target vulnhub - drivetingblues-9
Network security - firewall
[leetcode] 797 and 1189 (basis of graph theory)
树形结构数据的处理
Types of map key and object key
[technology development-23]: application of DSP in future converged networks
Common English Vocabulary
Three core issues of concurrent programming - "deep understanding of high concurrent programming"
Qtablewidget lazy load remaining memory, no card!
[data mining] task 1: distance calculation
2022 financial product revenue ranking