el-tree
默认选中第一项
必须结合 current-node-key属性和this.$refs['treeRef'].setCurrentKey()方法及this.$nexTick()同时使用
<el-tree
ref="tree"
accordion
:data="departmentData"
:props="defaultProps"
:highlight-current="true"
node-key="code"
:current-node-key="this.currentNode.code"
>
<p class="tree-node" slot-scope="{node,data}">
{{ data.name }}
</p>
</el-tree>
// 获取数据后设置默认选中值
this.$nextTick(()=>{
this.currentNode = this.departmentData[0];
this.$refs['tree'].setCurrentKey( this.currentNode.code)
})