vue连个数组对比

      let Ids = this.houseList.map(item => item.houseId);
      let arr = new Array();
      this.projectOptions.forEach((item, index) => {
        if (!Ids.includes(item.id)) {
          arr.push(item);
        }
      });
      this.projectOptions = arr;

  使用 .map 和  .includes 配合使用

posted @ 2021-06-10 21:50  假装空白  阅读(290)  评论(0编辑  收藏  举报