In the example method of loading node data for an elementui tree control, where does resolve come from and what does it mean?

especially the sentence return resolve ([{name: "region1"}, {name:" region2"}]), I don"t understand what return returns, resolve is passed in as a parameter, but where is the definition of resolve and how to use this method? please advise

< el-tree
: props= "props"
: load= "loadNode"
lazy
show-checkbox
@ check-change= "handleCheckChange" >
< / el-tree >

< script >
export default {

data() {
  return {
    props: {
      label: "name",
      children: "zones"
    },
    count: 1
  };
},
methods: {
  handleCheckChange(data, checked, indeterminate) {
    console.log(data, checked, indeterminate);
  },
  handleNodeClick(data) {
    console.log(data);
  },
  loadNode(node, resolve) {
    if (node.level === 0) {
      return resolve([{ name: "region1" }, { name: "region2" }]);
    }
    if (node.level > 3) return resolve([]);

    var hasChild;
    if (node.data.name === "region1") {
      hasChild = true;
    } else if (node.data.name === "region2") {
      hasChild = false;
    } else {
      hasChild = Math.random() > 0.5;
    }

    setTimeout(() => {
      var data;
      if (hasChild) {
        data = [{
          name: "zone" + this.countPP
        }, {
          name: "zone" + this.countPP
        }];
      } else {
        data = [];
      }

      resolve(data);
    }, 500);
  }
}

};
< / script >

Mar.31,2021

check out the introduction to Promise objects in http://es6.ruanyifeng.com/-sharpdo.!


callback function https://github.com/ElemeFE/el.

loadFn(this.root, (data) => {
  this.root.doCreateChildren(data);
  this._initDefaultCheckedNodes();
});
Menu