当我点击某个节点,获取到key然后修改对应数据库的label值,然后重新赋值data后使用getNode(选择的id),值依旧是为更改前端
editDepart(this.editFormData).then(res => {
this.SelectDepart();
console.log(111)
this.$nextTick(function () {
console.log(2222)
console.log(this.$refs.tree.getNode(2));
})
})
//初始化查询部门
SelectDepart() {
findDepart().then(res => {
this.DepartTree = convertTree(res.data);
})
},
树结构数据已经改变,但是getNode(修改的id)的值依旧是未更改前的!!
setTimeout(function(){
console.log(that.$refs.tree.getNode(that.editFormData.id))
}, 3000);
可以获取到最新的label,
但是!!!!!!!!!问题来了!!!!!
setTimeout(function(){
console.log(that.$refs.tree.getNode(that.editFormData.id))
console.log(that.$refs.tree.getCurrentNode(that.editFormData.id))
}, 3000);
getCurrentNode 居然依旧不是最新的!!!!