vant icon indicating copy to clipboard operation
vant copied to clipboard

SKU图片展示有BUG

Open oneosx opened this issue 7 years ago • 8 comments

你好,请使用下面的链接创建 issue 以帮助我们更快的排查问题,不规范的 issue 会被关闭,感谢配合。

https://youzan.github.io/vant-issue-generater


Please use the link below to create a new issue, the non-standard issue will be closed.

https://youzan.github.io/vant-issue-generater

更新版本后发现

image

如图,如果s1是颜色图片,那么点击颜色分类,左上角的预览图是有变化的(正常显示的)。如果颜色分类不是s1(有可能在s2, s3等),那么点击颜色分类图片,左上角的预览图无效。

oneosx avatar Aug 23 '19 04:08 oneosx

比如,正常的情况: image image

oneosx avatar Aug 23 '19 04:08 oneosx

能否提供一个测试数据看下

chenjiahan avatar Aug 23 '19 06:08 chenjiahan

比如:

sku data

{
    "hide_stock": true,
    "price": "22.44",
    "stock_num": 1249,
    "collection_id": "571268730517",
    "none_sku": false,
    "tree": [
        {
            "k_s": "s1",
            "k": "尺码",
            "v": [
                {
                    "id": "20509:28315",
                    "name": "M",
                    "imgUrl": ""
                },
                {
                    "id": "20509:28316",
                    "name": "L",
                    "imgUrl": ""
                },
                {
                    "id": "20509:28317",
                    "name": "XL",
                    "imgUrl": ""
                },
                {
                    "id": "20509:6145171",
                    "name": "2XL",
                    "imgUrl": ""
                },
                {
                    "id": "20509:115781",
                    "name": "3XL",
                    "imgUrl": ""
                },
                {
                    "id": "20509:3727387",
                    "name": "4XL",
                    "imgUrl": ""
                },
                {
                    "id": "20509:7539404",
                    "name": "5XL",
                    "imgUrl": ""
                }
            ]
        },
        {
            "k_s": "s2",
            "k": "颜色分类",
            "v": [
                {
                    "id": "1627207:28323",
                    "name": "粉色",
                    "imgUrl": "http://img.alicdn.com/bao/uploaded/TB1Sjx9weSSBuNjy0FlL6TBpVXa"
                },
                {
                    "id": "1627207:28338",
                    "name": "蓝色",
                    "imgUrl": "http://img.alicdn.com/bao/uploaded/TB1cXIGnOCYBuNkSnaVL6UMsVXa"
                }
            ]
        }
    ],
    "list": [
        {
            "price": 2244,
            "id": "3694325088370",
            "priceRMB": "156.00",
            "stock_num": 179,
            "s1": "20509:28315",
            "s2": "1627207:28323",
            "s3": 0,
            "s4": 0
        },
        {
            "price": 2244,
            "id": "3694325088371",
            "priceRMB": "156.00",
            "stock_num": 175,
            "s1": "20509:28316",
            "s2": "1627207:28323",
            "s3": 0,
            "s4": 0
        },
        {
            "price": 2244,
            "id": "3694325088372",
            "priceRMB": "156.00",
            "stock_num": 162,
            "s1": "20509:28317",
            "s2": "1627207:28323",
            "s3": 0,
            "s4": 0
        },
        {
            "price": 2244,
            "id": "3694325088373",
            "priceRMB": "156.00",
            "stock_num": 163,
            "s1": "20509:6145171",
            "s2": "1627207:28323",
            "s3": 0,
            "s4": 0
        },
        {
            "price": 2244,
            "id": "3694325088374",
            "priceRMB": "156.00",
            "stock_num": 181,
            "s1": "20509:115781",
            "s2": "1627207:28323",
            "s3": 0,
            "s4": 0
        },
        {
            "price": 2244,
            "id": "3694325088375",
            "priceRMB": "156.00",
            "stock_num": 190,
            "s1": "20509:3727387",
            "s2": "1627207:28323",
            "s3": 0,
            "s4": 0
        },
        {
            "price": 2244,
            "id": "3694325088376",
            "priceRMB": "156.00",
            "stock_num": 186,
            "s1": "20509:7539404",
            "s2": "1627207:28323",
            "s3": 0,
            "s4": 0
        },
        {
            "price": 2244,
            "id": "3694325088377",
            "priceRMB": "156.00",
            "stock_num": 5,
            "s1": "20509:28315",
            "s2": "1627207:28338",
            "s3": 0,
            "s4": 0
        },
        {
            "price": 2244,
            "id": "3694325088380",
            "priceRMB": "156.00",
            "stock_num": 1,
            "s1": "20509:6145171",
            "s2": "1627207:28338",
            "s3": 0,
            "s4": 0
        },
        {
            "price": 2244,
            "id": "3694325088382",
            "priceRMB": "156.00",
            "stock_num": 2,
            "s1": "20509:3727387",
            "s2": "1627207:28338",
            "s3": 0,
            "s4": 0
        },
        {
            "price": 2244,
            "id": "3694325088383",
            "priceRMB": "156.00",
            "stock_num": 5,
            "s1": "20509:7539404",
            "s2": "1627207:28338",
            "s3": 0,
            "s4": 0
        }
    ]
}

默认图片

{
    "title": "大码女装中长款妈妈短袖裙子2019小个子春夏修身35岁到45的连衣裙",
    "picture": "http://img.alicdn.com/bao/uploaded/i4/2010093597/TB21WkqwnJYBeNjy1zeXXahzVXa_!!2010093597-0-item_pic.jpg"
}

截图: image

oneosx avatar Aug 23 '19 09:08 oneosx

这不是 bug,目前Sku组件只支持第一层 sku 点击切换预览图......得考虑下是否需要支持非第一层 sku 切换预览图

Codpoe avatar Aug 23 '19 09:08 Codpoe

这样的啊,很多情况下,颜色分类不一定是s1呢,希望可以兼容一下

oneosx avatar Aug 23 '19 10:08 oneosx

嗯,了解👌

Codpoe avatar Aug 23 '19 10:08 Codpoe

其实可以通过“sku-selected”事件来解决,还好vant自定义属性蛮丰富,赞一个!

selectedImg: function(skuValue) {
    if (skuValue.skuValue && skuValue.skuValue.imgUrl) {
        this.goods.picture = skuValue.skuValue.imgUrl
    }
}

oneosx avatar Aug 23 '19 11:08 oneosx

已在 2.1.6 版本支持

chenjiahan avatar Aug 26 '19 02:08 chenjiahan