Element UI组件Cascader 级联选择器 最后一级children为0时bug

我的4级组织机构,后台返回的数据,最后一层有children,但是没有数据。Cascader bug,最后一层会显示一个空的面板。
因此只能手动处理,最后一层children = undefined;

//4层组织机构,最后一级children数量为零的空旷bug。
let nums = this.organizationList.length;
for(var i = 0; i < nums; i++){
  for(var i2 = 0; i2 < this.organizationList[i].children.length; i2++){
    for(var i3 = 0; i3 < this.organizationList[i].children[i2].children.length; i3++){
      for(var i4 = 0; i4 < this.organizationList[i].children[i2].children[i3].children.length; i4++){
        if(this.organizationList[i].children[i2].children[i3].children[i4].children <= 0){
          this.organizationList[i].children[i2].children[i3].children[i4].children = undefined;
        }
      }
    }
  }
}

相关推荐