根据某一字段的值进行分类重组
源数据:
var _arr = [{ aId: 1, bId: 11, cId: 112, }, { aId: 1, bId: 11, cId: 113, }, { aId: 1, bId: 12, cId: 114, }, { aId: 2, bId: 21, cId: 211, }]
期望:
[{ aId: 1, children: [{ bId: 11, children: [{ cId: 112 }, { cId: 113 }] }, { bId: 12, children: [{ cId: 114 }] }] }, { aId: 2, children: [{ bId: 21, children: [{ cId: 211 }] }] }]
缥缈止盈
相关分类