废话不说,直接上方法:
//arr 去重的数组
//key 对象的key
export function uniquekey(arr, key) {
const map = new Map();
return arr.filter(item => {
const _item = item;
return !map.has(_item[key]) && map.set(_item[key], 1);
})
}
废话不说,直接上方法:
//arr 去重的数组
//key 对象的key
export function uniquekey(arr, key) {
const map = new Map();
return arr.filter(item => {
const _item = item;
return !map.has(_item[key]) && map.set(_item[key], 1);
})
}