1.el-tree设置 node-key,current-node-key,default-expanded-keys,highlight-current:
<el-tree
ref="taskTree"
:data="ptreeData"
node-key="key"
:current-node-key="currentKey"
:default-expanded-keys="defaultExpanded"
highlight-current>
</el-tree>
2.赋值数据
nextTick(() => {currentKey.value=firstNode.key;taskTree.value.setCurrentKey(firstNode.key);defaultExpanded.value=nodeIds;})
注意:使用了nextTick。