default-expanded-keys值可以设置指定节点展开关闭状态
html代码:
:data="speNodeData"
:expand-on-click-node="true"
:check-on-click-node="true"
node-key="id"
ref="tree"
accordion
:default-expand-all="false"
default-expanded-keys="['a123','b123']"
:highlight-current="true"
:props="defaultProps"
@node-click="clickNode">
数据结构:
[
{
"id":"a123",
"label":"树1",
"isNode":null,
"moduleId":null,
"relationType":null,
"ralationTypeId":null,
"orderNum":0,
"parentId":null,
"children":[]
},
{
"id":"b123",
"label":"树2",
"isNode":null,
"moduleId":null,
"relationType":null,
"ralationTypeId":null,
"orderNum":0,
"parentId":null,
"children":[]
}
]
效果图: