antdVue 展开全部节点
<a-tree
:expanded-keys="expandedKeys"
:selected-keys="selectedKeys"
:tree-data="treeDeptData"
@expand="onExpand"
@select="onSelect"
:replaceFields="{ children: 'children', title: 'name', key: 'id' }"
>
// 拿到数据 去递归节点赋值
this.recursiveExpand(this.treeDeptData, this.expandedKeys)
recursiveExpand(arr, tmp) {
for (let i = 0; i < arr.length; i++) {
tmp.push(arr[i].id)
if (arr[i].children !== null && arr[i].children.length > 0) {
this.recursiveExpand(arr[i].children, tmp)
}
}
return tmp
},