有个问题就是,我用foreach遍历数组,但是调用的时候总是只用最后一个,前面的都被覆盖了,我记得可以用一个新数组存起来,但是忘记怎么写,求大佬帮解答一下??
我是element-ui的框架
          this.HouseInfo.forEach(element => {            this.communityId = element.id;            console.log(this.communityId);
            element.value = element.name;
            element.label = element.name;
            element.children = [];
          });          //在下面调用
     _getBuilding() {
      list_building({
        communityId: this.communityId
      })
        .then(res => {          console.log(res.data);
        })
        .catch(err => {});
    },
    handleItemChange(val) {      // this._getCommunityList();
      this._getBuilding();      console.log(val);      // console.log(val);
    }, 遍历出是这三个数据,但是用的时候都只是最后一个!
遍历出是这三个数据,但是用的时候都只是最后一个!
用的都是最后一个??
 森栏
森栏 
					慕妹3242003
 随时随地看视频慕课网APP
随时随地看视频慕课网APP
相关分类