import { uniqBy } from 'lodash'
let arr2 = [ { x: 1, y: 3 }, { x: 2, y: 3 }, { x: 1, y: 3 } ]
console.log(uniqBy(arr2, 'y'), '哈哈哈哈') // [{x:1, y:3}]
console.log(uniqBy(arr2, 'x'), '哈哈哈哈') // [ { x: 1, y: 3 }, { x: 2, y: 3 }]
lodash好用系列- json数组,根据指定key去重
最新推荐文章于 2022-08-11 11:11:19 发布