数据格式如下,每次点击得到不一样的对象,然后最后把点到的对象添加到一个数组中
let obj = {
"id": "46f7c6ba-b4ca-4843-b5d1-76399d1ac52a",
"parentId": "a80ff169-d6f6-4752-b980-fd818240410f",
"attributeName1": "颜色",
"attributeValue1": "黄色",
"attributeName2": "尺寸1",
"attributeValue2": "S",
"skuCode": "10",
"skuName": "美年达1",
"price": 10,
"isShelf": "上架",
"check": true
}
想要的数据:
let arr = [
{
"id": "46f7c6ba-b4ca-4843-b5d1-76399d1ac52a",
"parentId": "a80ff169-d6f6-4752-b980-fd818240410f",
"attributeName1": "颜色",
"attributeValue1": "黄色",
"attributeName2": "尺寸1",
"attributeValue2": "S",
"skuCode": "10",
"skuName": "美年达1",
"price": 10,
"isShelf": "上架",
"check": true
},
{
"id": "46f7c6ba-b4ca-4843-b5d1-76399d1ac52a",
"parentId": "a80ff169-d6f6-4752-b980-fd818240410f",
"attributeName1": "颜色",
"attributeValue1": "黄色",
"attributeName2": "尺寸1",
"attributeValue2": "S",
"skuCode": "10",
"skuName": "美年达1",
"price": 10,
"isShelf": "上架",
"check": true
}
]