typescript 数组根据指定字段去重

this.listDataIn = data.Result.data;
 const uniqueItems: Item[] = Array.from(
          new Set(this.listDataIn.map(item => item.MyLandID))
        ).map(id => {
          return obj.listDataIn.find(item => item.MyLandID === id);
        });
        obj.listt = uniqueItems;
        console.log(uniqueItems);

 

posted @ 2023-08-24 14:15  3939!  阅读(115)  评论(0编辑  收藏  举报