抱着猫睡觉的鱼_ 2022-03-12 17:17 采纳率: 51.7%
浏览 42
已结题

vue js数据处理的问题

数据如下,每一项的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": "缓凝"
    }
]

  • 写回答

0条回答 默认 最新

    报告相同问题?

    问题事件

    • 系统已结题 3月20日
    • 创建了问题 3月12日

    悬赏问题

    • ¥15 微软硬件驱动认证账号申请
    • ¥15 有人知道怎么在R语言里下载Git上的miceco这个包吗
    • ¥15 GPT写作提示指令词
    • ¥20 如何在cst中建立这种螺旋扇叶结构
    • ¥20 根据动态演化博弈支付矩阵完成复制动态方程求解和演化相图分析等
    • ¥20 关于DAC输出1.000V对分辨率和精度的要求
    • ¥20 想写一个文件管理器,加载全部子文件夹后,要一级一级返回
    • ¥15 华为超融合部署环境下RedHat虚拟机分区扩容问题
    • ¥15 哪位能做百度地图导航触点播报?
    • ¥15 请问GPT语言模型怎么训练?