数组中包含对象如何去重
let arr = [
{id:1,pid:1},
{id:2,pid:1},
{id:2,pid:1},
{id:3,pid:1},
{id:6,pid:1},
{id:3,pid:1},
{id:6,pid:1},
]
// console.log([...new Set(arr)],'===sfdgsdfgs')
// console.log([...new Set(arr.map(item => JSON.stringify(item)))],'=======map')
let newarr = [...new Set(arr.map(item => JSON.stringify(item)))];
let aaaarr = newarr.map(item => JSON.parse(item))
console.log(aaaarr,'====aaaarr');