数据如下,每一项的image根据attributeValue来赋值,所有attributeValue1这一项的image是有值的话,那就把其他同样值的attributeValue1这一项的image赋值,以此类推attribute2,3,4... 应该如何修改,感谢各位
let arr = [
{
"skuCode": "cxzcxz",
"skuName": "fdgfdgfd",
"price": "",
"isShelf": "1",
"image": "https://lumall.inspures.com/images/product/6985e333-dd45-45dc-b496-889400f1eb9a.png",
"uniqueCategoryKey": "11,21,31",
"attributeName1": "种类1",
"attributeValue1": "P.Ⅰ",
"attributeName2": "强度2",
"attributeValue2": "32.5",
"attributeName3": "其他",
"attributeValue3": "免税"
},
{
"skuCode": "cxzcxz",
"skuName": "dvfdg",
"price": "",
"isShelf": "1",
"image": "https://lumall.inspures.com/images/product/7a2a169a-c08c-4492-914a-e6f878c3b204.png",
"uniqueCategoryKey": "11,21,32",
"attributeName1": "种类1",
"attributeValue1": "P.Ⅰ",
"attributeName2": "强度2",
"attributeValue2": "32.5",
"attributeName3": "其他",
"attributeValue3": "缓凝"
},
{
"skuCode": "dsadsad",
"skuName": "vfvf",
"price": "",
"isShelf": "1",
"image": "",
"uniqueCategoryKey": "12,21,31",
"attributeName1": "种类1",
"attributeValue1": "P.Ⅱ",
"attributeName2": "强度2",
"attributeValue2": "32.5",
"attributeName3": "其他",
"attributeValue3": "免税"
},
{
"skuCode": "vcxvcx",
"skuName": "dsadsadsa",
"price": "",
"isShelf": "1",
"image": "",
"uniqueCategoryKey": "12,21,32",
"attributeName1": "种类1",
"attributeValue1": "P.Ⅱ",
"attributeName2": "强度2",
"attributeValue2": "32.5",
"attributeName3": "其他",
"attributeValue3": "缓凝"
}
]
想要的数据格式,相同attributeValue1这一项的image是相同的,同样attributeValue2这一项的image也是相同的,attributeValue1的image找attributeValue1的value2的找value2的,以此类推
[
{
"skuCode": "cxzcxz",
"skuName": "fdgfdgfd",
"price": "",
"isShelf": "1",
"image": "https://lumall.inspures.com/images/product/6985e333-dd45-45dc-b496-889400f1eb9a.png",
"uniqueCategoryKey": "11,21,31",
"attributeName1": "种类1",
"attributeValue1": "P.Ⅰ",
"attributeName2": "强度2",
"attributeValue2": "32.5",
"attributeName3": "其他",
"attributeValue3": "免税"
},
{
"skuCode": "cxzcxz",
"skuName": "dvfdg",
"price": "",
"isShelf": "1",
"image": "https://lumall.inspures.com/images/product/6985e333-dd45-45dc-b496-889400f1eb9a.png",
"uniqueCategoryKey": "11,21,32",
"attributeName1": "种类1",
"attributeValue1": "P.Ⅰ",
"attributeName2": "强度2",
"attributeValue2": "32.5",
"attributeName3": "其他",
"attributeValue3": "缓凝"
},
{
"skuCode": "dsadsad",
"skuName": "vfvf",
"price": "",
"isShelf": "1",
"image": "https://lumall.inspures.com/images/product/7a2a169a-c08c-4492-914a-e6f878c3b204.png",
"uniqueCategoryKey": "12,21,31",
"attributeName1": "种类1",
"attributeValue1": "P.Ⅱ",
"attributeName2": "强度2",
"attributeValue2": "32.5",
"attributeName3": "其他",
"attributeValue3": "免税"
},
{
"skuCode": "vcxvcx",
"skuName": "dsadsadsa",
"price": "",
"isShelf": "1",
"image": "https://lumall.inspures.com/images/product/7a2a169a-c08c-4492-914a-e6f878c3b204.png",
"uniqueCategoryKey": "12,21,32",
"attributeName1": "种类1",
"attributeValue1": "P.Ⅱ",
"attributeName2": "强度2",
"attributeValue2": "32.5",
"attributeName3": "其他",
"attributeValue3": "缓凝"
}
]