// 去除id相同的数据
const arr = [{id:1,name:'ming'},{id:2,name:'ming2'},{id:1,name:'ming'}] const newArr = arr.reduce(function (tempArr, item) { if (tempArr.findIndex((ele) => ele.id === item.id) === -1) { tempArr.push(item) } return tempArr }, [])
// 去除id相同的数据
const arr = [{id:1,name:'ming'},{id:2,name:'ming2'},{id:1,name:'ming'}] const newArr = arr.reduce(function (tempArr, item) { if (tempArr.findIndex((ele) => ele.id === item.id) === -1) { tempArr.push(item) } return tempArr }, [])