我想按数组中的子工作分组这是我想按子工作分组的数组 result = [ { "date": "10-07-2019", "data": [ { "data_id": "20", "work": "work_1", "sub-work": "sub_work1", "sub-data": [ { "id": 7, "title": 'subdata-1', } ] } ] }, { "date": "12-07-2019", "data": [ { "data_id": "20", "work": "work_1", "sub-work": "sub_work1", "sub-data": [ { "id": 7, "title": 'subdata-1', } ] } ] }, ]这是我尝试的result = _(result) .map(function(items, data) { _.groupBy(items.data, function({ sub_work }) { return sub_work; }); }) .value();首先我将结果映射到数据然后我尝试 groupby 但它返回 null
添加回答
举报
0/150
提交
取消