数组去重

const map = new Map()

for (const item of column) {

if (!map.has(item.name)) {

map.set(item.name, item) } }

 

 

例如:

  // 数组去重
      const map = new Map();
      for (const item of this.areaCode) {
        if (!map.has(item.id)) {
          map.set(item.id, item);
        }
      }
      this.areaCode = [...map.values()];
posted @ 2021-08-05 14:57  诡道也  阅读(35)  评论(0编辑  收藏  举报