解決方法:標簽內(nèi)添加v-if
<a-tree
v-if="tree.length"
:default-expand-all="defaultExpandAll"
multiple
:selected-keys="selectedKeys"
:checked-keys="checkedKeys"
:tree-data="tree"
:check-strictly="true"
@select="onSelect"
@check="onCheck"
@rightClick="rightHandle"
/>
-----------------分割線-------------------
2021.3.4更新 官網(wǎng)答疑
defaultExpandAll在異步加載數(shù)據(jù)時不生效
default前綴屬性只有在初始化時生效炒瘸,異步加載數(shù)據(jù)時defaultExpandAll已經(jīng)執(zhí)行完成编整,可以通過設(shè)置expandedKeys變量來手動控制或在數(shù)據(jù)加載完成后渲染樹組件(vue中即v-if)