antdv 中 a-tree 的 defaultExpandAll 不起作用

在 a-tree 中设置了  
:defaultExpandAll="true"

但是,tree 中的数据并没有展开,

那是因为默认设置在 tree 中的 data 为空的时候,就起作用了,所以当再赋值新的

数据时, 这个属性不会再次生效,

要在 a-tree 中加个条件,当数据长度大于0 , 再启用这些属性,

1       <a-tree
2       v-if="treeData.length > 0"
3       :show-line="true"
4       :show-icon="true"
5       :defaultExpandAll="true"
6       :tree-data="treeData"
7       @select="onSelect"
8     >
9     </a-tree>

这样的话,就可以起作用了。

posted @ 2022-07-27 14:55  googlegis  阅读(1074)  评论(0编辑  收藏  举报

坐标合肥,非典型GIS开发人员 GitHub