let data = [
{value: 8,label: '苹果'},
{value: 6, label: '香蕉'},
{value: 12, label: '葡萄'},
]
data = data.map(item => {
return {
name: item.label,
price: item.value
}
})
console.log(data) // [{name: "苹果", price: 8}, {name: "香蕉", price: 6}, {name: "葡萄", price: 12}]
网友评论