1,数组里面包含对象
var lookMachineList= [
{
add_id: 151
add_name: "ZTO"
add_time: "2019-07-24 09:51:16"
id: 11
is_delete: 0
machine_type: "sx9_95"
machine_vender: "中通"
memo: ""
modify_id: null
modify_name: null
modify_time: null
param_name: "X9s"
resolution_ratio: "375*567"
},
{
add_id: 1511
add_name: "YTO"
add_time: "2019-07-24 09:51:16"
id: 12
is_delete: 0
machine_type: "sx9_95"
machine_vender: "圆通"
memo: ""
modify_id: null
modify_name: null
modify_time: null
param_name: "X9p"
resolution_ratio: "375*567"
}
]
2,只保留param_name参数值组成的数组对象格式:
[
{param_name: "X9s"},
{param_name: "X9p"}
]
3,代码:
lookMachineList = lookMachineList.map(element => { return {param_name: element}; });