- 对树的数组获取第一节点的id进行展示
- 使用这个属性
- :default-expanded-keys=“unfoldId”
<el-tree
ref="treeForm"
style="margin-top:30px"
:data="organTreeData"
show-checkbox
check-strictly
node-key="id"
:default-expanded-keys="unfoldId"
highlight-current
:filter-node-method="filterNode"
:expand-on-click-node="false"
:props="defaultProps"
@check="setChecked"
@check-change="handleCheckChange"
>
computed: {
unfoldId() {
var arr = []
if (this.organTreeData && this.organTreeData.length > 0) {
this.organTreeData.forEach(x => {
if (x.id) {
arr.push(x.id)
}
})
}
return arr
}
},