问题现象

elmentui的el-tree数据加载问题,导致第一次加载选中当前节点和高亮当前节点没有生效。

解决方案

默认展开节点的解决

在el-tree上面挂上data-change

<el-tree ref="orgTree" :options="orgTreeOptons" @data-change="handlechange" >
</el-tree>

使用nextTick进行设置

handlechange() {
  this.$nextTick(() => {
     this.$refs.orgTree.$refs.tree.setCurrentKey(this.treeNodeKey);
  });
},

默认高亮节点的解决

this.$refs.orgTree.$options.propsData.options.tree.defaultExpandedKeys = this.expandKey;

相关文章:

  • 2023-03-28
  • 2023-01-04
  • 2022-01-03
  • 2021-07-19
  • 2022-12-23
  • 2023-04-10
  • 2023-04-11
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-28
  • 2021-11-22
相关资源
相似解决方案