当前位置:网站首页>All expansion and collapse of a-tree
All expansion and collapse of a-tree
2022-07-05 22:26:00 【Short and brilliant】
ant-design-vue Trees a-tree It is necessary to realize the function of all expansion and all retraction

this.$refs.tree.store This data is printed out , Inside expanded Is to control the function of expanding and folding
\
Code implementation :
<div class="expand">
<a-button size="small" @click="expandHandle">{
{
expandAll ? " Put it all away " : " Expand all "
}}</a-button>
</div>
<div class="func">
<span>name</span>
<span>value</span>
</div>
<a-tree
:data="treeData"
show-checkbox
node-key="id"
:default-expand-all="expandAll"
:default-expanded-keys="defaultExpandedKeys"
:expand-on-click-node="false"
ref="tree"
@check="handleCheck"
>
<span class="custom-tree-node" slot-scope="{ node, data }">
<span>{
{ node.label }}</span>
<span>{
{ data.type }}</span>
</span>
</a-tree>
methods Method
expandHandle() {
console.log(this.$refs.tree.store);
this.expandAll = !this.expandAll;
this.expandNodes(this.$refs.tree.store.root);
},
// Traverse tree data , Set the expanded attribute , Realize expansion and collapse
expandNodes(node) {
node.expanded = this.expandAll;
for (let i = 0; i < node.childNodes.length; i++) {
node.childNodes[i].expanded = this.expandAll;
if (node.childNodes[i].childNodes.length > 0) {
this.expandNodes(node.childNodes[i]);
}
}
},
边栏推荐
- [error record] file search strategy in groovy project (src/main/groovy/script.groovy needs to be used in the main function | groovy script directly uses the relative path of code)
- 记录几个常见问题(202207)
- Pl/sql basic syntax
- Interprocess communication in the "Chris Richardson microservice series" microservice architecture
- ESP32 hosted
- Performance monitoring of database tuning solutions
- Sparse array [matrix]
- Nacos installation and service registration
- Nacos 的安装与服务的注册
- Shelved in TortoiseSVN- Shelve in TortoiseSVN?
猜你喜欢

How can Bluetooth in notebook computer be used to connect headphones
![[groovy] groovy dynamic language features (automatic type inference of function arguments in groovy | precautions for function dynamic parameters)](/img/ab/086c7455706eecc467eef92c660803.jpg)
[groovy] groovy dynamic language features (automatic type inference of function arguments in groovy | precautions for function dynamic parameters)

Database tuning solution

opencv 判断点在多边形内外

Index optimization of performance tuning methodology

Depth first DFS and breadth first BFS -- traversing adjacency tables

Implementation technology of recovery

EasyCVR集群部署如何解决项目中的海量视频接入与大并发需求?

Pl/sql basic syntax

Distributed resource management and task scheduling framework yarn
随机推荐
Common interview questions of redis factory
Alternating merging strings of leetcode simple questions
Database recovery strategy
[error record] groovy function parameter dynamic type error (guess: groovy.lang.missingmethodexception: no signature of method)
Calculation method of boundary IOU
How to develop and introduce applet plug-ins
Navigation day answer applet: preliminary competition of navigation knowledge competition
1.3 years of work experience, double non naked resignation agency face-to-face experience [already employed]
Concurrency control of performance tuning methodology
Distance from point to line intersection and included angle of line
Form artifact
Oracle is sorted by creation time. If the creation time is empty, the record is placed last
How to create a thread
Golang writes the opening chapter of selenium framework
The new content of the text component can be added through the tag_ Config set foreground and background colors
Wonderful review of the digital Expo | highlight scientific research strength, and Zhongchuang computing power won the digital influence enterprise award
Leetcode simple question: find the nearest point with the same X or Y coordinate
New 3D particle function in QT 6.3
Storage optimization of performance tuning methodology
Nacos installation and service registration