vue 运用ElementUI,做select下拉框回显

743 阅读1分钟

看下回显数据:

 {
        "id": 6,
        "deliveryType": null,
        "productBrand": "D的杂货铺",
        "productAttr": "[{\"key\":\"颜色\",\"value\":\"绿色\"},{\"key\":\"尺寸\",\"value\":\"PLUS\"}]",
        "productPic": "/dd.jpg",
        "productName": "苹果13",
        "productQuantity": 2,
        "deliveryCompanyName": "中通速递",
        "deliveryCompanyId": null,
        "deliverySn": "7457485",
        "deliveryUpdateStatus": 1,
        "deliveryTime": "2021-09-02 15:02:11",
        "status": 2,
        "deliveryUser": null,
        "unadjustedAmount": 9998,
        "presentTotal": 9998,
        "discountAmount": null,
        "buyAmount": 4999,
        "afterSaleStatus": null,
        "freightAmount": 16,
        "actualTotal": 10014,
        "butTotal": null,
        "adjustAmount": 0,
        "spData": [
          {
            "key": "颜色",
            "value": "绿色"
          },
          {
            "key": "尺寸",
            "value": "PLUS"
          }
        ]
      },

image.png

elementUI的el-select中v-model的值要跟遍历出来的option的值的类型要保持一致才可以回显成功