element的tree树回显问题?

第一次获取数据不会回显,第二次才会回显
两个接口 第一个是获取所有的权限的,第二个是获取已有权限的
image.png
我第二次获取才会回显
image.png

搞一天了 也没找出来原因.....

主要代码:


async handleChangePower(row) {
  this.power = true;
  await this.getRolePermisson03();
  // this.getRolePermisson03()

  this.roleForm.roleId = row.id;

  await this.getRolePermisson04();
  this.dialogFormVisiblePower = true;
},


getRolePermisson03() {
  getPermissionTree().then(res => {
    console.log("获取所有权限111", res);
    this.cities = res.data.data;
  });
},

image.png

getRolePermisson04() {
  getPermissionIds(this.roleForm).then(res => {
    console.log("角色权限", res);
    this.$nextTick(() => {
      this.checkedCities = res.data.data;
        // 数据格式[1,2,3]
    });
  });
},
阅读 2.8k
1 个回答
async handleChangePower(row) {
  this.power = true;
  await this.getRolePermisson03();

  this.roleForm.roleId = row.id;

  await this.getRolePermisson04();
  this.dialogFormVisiblePower = true; 
},

getRolePermisson04() {
  getPermissionIds(this.roleForm).then(res => {
    console.log("角色权限", res);
    this.$nextTick(() => {
      this.checkedCities = res.data.data;
      this.dialogFormVisiblePower = true; 
    });
  });
},
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题