lodash.groupBy 处理数组对象按需分组

7,327 阅读1分钟

groupBy

let a = [{id:1,name:'me'},{id:1,name:'you'},{id:2,name:'her'}];
_.groupBy(a,'id'); //就可以实现按id分组了。