在角色资源管理的时候 点击设置资源 弹出资源列表的树 ,并且赋上默认值,但是在第一次调用弹出层的方法,会报这个错,第二次点击的时候不会报这个错 而且 getHalfCheckedKeys也使用不了 handleSetResource(val) { this.Visible = true this.Status = 'setResource' const currRes = val.resources for(const v of currRes){ console.log(v.id) this.$refs.tree.setCheckedKeys([v.id]); } }, getHalfCheckedKeys() { console.log(this.$refs.tree.getHalfCheckedKeys()); },
2 回答

开满天机
TA贡献1786条经验 获得超13个赞
在弹出dialog之前执行$nextTick回调函数,确保el-tree已经渲染
this.visible = true;
this.$nextTick(() => {
// code
});
添加回答
举报
0/150
提交
取消