如下data数组,如何根据 相同的
"shop_id"
"shop_name"
转成data1数组
var data = [{
"cart_goods_number": 3,
"goods_id": 3,
"goods_name": "honor7x",
"goods_img": "honor7x.png",
"goods_price": 1299,
"shop_id": 4,
"shop_name": "honor之家"
}, {
"cart_goods_number": 2,
"goods_id": 4,
"goods_name": "honor6x",
"goods_img": "honor6x.png",
"goods_price": 1199,
"shop_id": 4,
"shop_name": "honor之家"
}, {
"cart_goods_number": 1,
"goods_id": 1,
"goods_name": "iPhonex",
"goods_img": "iPhonex.png",
"goods_price": 8888,
"shop_id": 1,
"shop_name": "iPhone之家"
}]
var data1 = [{
"shop_id": 4,
"shop_name": "honor之家",
goodsList: [{
"cart_goods_number": 3,
"goods_id": 3,
"goods_name": "honor7x",
"goods_img": "honor7x.png",
"goods_price": 1299,
}, {
"cart_goods_number": 2,
"goods_id": 4,
"goods_name": "honor6x",
"goods_img": "honor6x.png",
"goods_price": 1199,
}]
}, {
"shop_id": 1,
"shop_name": "iPhone之家",
goodsList: [{
"cart_goods_number": 1,
"goods_id": 1,
"goods_name": "iPhonex",
"goods_img": "iPhonex.png",
"goods_price": 8888,
}]
}]
翻翻过去那场雪
宝慕林4294392
哈士奇WWW
犯罪嫌疑人X
互换的青春
LEATH
哔哔one
相关分类