当我进行 http 请求时,我得到了对象数组,例如:
[
{ row: '3', col: '1', val: '10:00' },
{ row: '3', col: '2', val: 'Some text' },
{ row: '3', col: '3', val: 'Yura' },
{ row: '3', col: '4', val: '676031383' },
{ row: '3', col: '6', val: '9:00 ' },
{ row: '3', col: '7', val: 'Some text' },
{ row: '3', col: '8', val: 'Alex' },
{ row: '3', col: '9', val: '965773775' },
{ row: '4', col: '1', val: '7:00' },
{ row: '4', col: '2', val: 'Some text' },
{ row: '4', col: '3', val: 'Anya' },
{ row: '4', col: '4', val: '951018689' },
{ row: '4', col: '6', val: '08:00' },
{ row: '4', col: '7', val: 'Some text' },
{ row: '4', col: '8', val: 'Dima' },
{ row: '4', col: '9', val: '961452584' },
]
问题是我需要将这些对象组合成一个并再添加一个 key- type,例如:
{ time: 10:00, info: 'Some text', name: 'Yura', phone: '676031383', type: 'Driver' }
{ time: 9:00, info: 'Some text', name: 'Alex', phone: '965773775', type: 'Passenger' }
{ time: 7:00, info: 'Some text', name: 'Anya', phone: '951018689', type: 'Driver' }
{ time: 8:00, info: 'Some text', name: 'Dima', phone: '951018689', type: 'Passenger' }
From 1to 4type 应该是“Driver”,from 6to9应该是“Passenger”。响应没有 5 列,因为她是空的
有可能以某种方式做到这一点吗?我花了几个小时,但没有结果
开心每一天1111
GCT1015
萧十郎
随时随地看视频慕课网APP
相关分类