当前位置:网站首页>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]);
}
}
},
边栏推荐
- Interprocess communication in the "Chris Richardson microservice series" microservice architecture
- Learning of mall permission module
- Lightweight dynamic monitorable thread pool based on configuration center - dynamictp
- Business learning of mall order module
- MySQL disconnection reports an error MySQL ldb_ exceptions. OperationalError 4031, The client was disconnected by the server
- Overview of concurrency control
- How to create a thread
- How to develop and introduce applet plug-ins
- Overview of database recovery
- Platform bus
猜你喜欢
Wonderful review of the digital Expo | highlight scientific research strength, and Zhongchuang computing power won the digital influence enterprise award
2022-07-05: given an array, you want to query the maximum value in any range at any time. If it is only established according to the initial array and has not been modified in the future, the RMQ meth
The statistics of leetcode simple question is the public string that has appeared once
Advantages and disadvantages of the "Chris Richardson microservice series" microservice architecture
科技云报道:算力网络,还需跨越几道坎?
Metaverse ape received $3.5 million in seed round financing from negentropy capital
Postman核心功能解析-参数化和测试报告
opencv 判断点在多边形内外
如何快速体验OneOS
Pl/sql basic case
随机推荐
Wonderful review of the digital Expo | highlight scientific research strength, and Zhongchuang computing power won the digital influence enterprise award
How to develop and introduce applet plug-ins
Index optimization of performance tuning methodology
Metaverse Ape猿界应邀出席2022·粤港澳大湾区元宇宙和web3.0主题峰会,分享猿界在Web3时代从技术到应用的文明进化历程
QT creator 7 beta release
C language - structural basis
How to reverse a string fromCharCode? - How to reverse String. fromCharCode?
509. Fibonacci Number. Sol
2022 Software Test Engineer salary increase strategy, how to reach 30K in three years
Go language learning tutorial (XV)
了解 Android Kotlin 中 DataStore 的基本概念以及为什么应该停止在 Android 中使用 SharedPreferences
解决thinkphp启动时“No input file specified”的问题
Implementation technology of recovery
元宇宙中的三大“派系”
Cobaltstrike builds an intranet tunnel
Win11运行cmd提示“请求的操作需要提升”的解决方法
a-tree 树的全部展开和收起
Why does the C# compiler allow an explicit cast between IEnumerable&lt; T&gt; and TAlmostAnything?
Metaverse Ape获Negentropy Capital种子轮融资350万美元
[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)