[Vue-TreeselectWarning]Unloadedbranchnodedetected.“loadOptions“propisrequiredtoloaditsc

原创
小哥 2年前 (2022-12-19) 阅读数 40 #大杂烩

[Vue-Treeselect Warning] Unloaded branch node detected. “loadOptions” prop is required to load its children

Vue-Treeselect在返回的数据中child为null所有需要的将是null的删除

    getOfficeTree() {
        this.treeData = [res.data];
        this.getTreeName(this.treeData)
    },
    getTreeName(list) {
      let _this = this;
      list.forEach((item, index) => {
        let a = item;
        if (index < list.length) {
          if (a.child == null) {
            delete a.child
          }
        }
        if (a.child && a.child.length > 0) {
          if (a.child && a.child.length > 0) {
            _this.getTreeName(a.child);
          }
        }
      });
      return;
    },

最终this.treeData值将更改:全部删除。child:null

版权声明

所有资源都来源于爬虫采集,如有侵权请联系我们,我们将立即删除

热门