注意:一定要写上this.$nextTick 否则不生效
currentNodekey: "", //默认选中的节点树 async treeByDept() { await treeByDept({}).then((res) => { this.architectureData = res.data; if (this.architectureData.length > 0) { this.currentNodekey = this.architectureData[0].id; this.$nextTick(() => { this.$refs.treeRef.setCurrentKey(this.currentNodekey); //一定要加这个选中了否则样式没有出来 }); } }); },
原文:https://www.cnblogs.com/web-aqin/p/14926651.html