数组按照某个key分组
const recordsGroup = (key) => {
return records.reduce((prev, cur) => {
(prev[cur[key]] = prev[cur[key]] || []).push(cur)
return prev;
}, {});
};
const recordsGroup = (key) => {
return records.reduce((prev, cur) => {
(prev[cur[key]] = prev[cur[key]] || []).push(cur)
return prev;
}, {});
};