diff --git a/src/sku/README.md b/src/sku/README.md index 8beafde02..5d0b9452c 100644 --- a/src/sku/README.md +++ b/src/sku/README.md @@ -143,6 +143,7 @@ export default { | safe-area-inset-bottom `v2.2.1` | Whether to enable bottom safe area adaptation | *boolean* | `false` | | start-sale-num `v2.3.0` | Minimum quantity | *number* | `1` | | properties `v2.4.2` | Goods properties | *array* | - | +| preview-on-click-image | Whether to preview image when click goods image | *boolean* | `true` | ### Events diff --git a/src/sku/README.zh-CN.md b/src/sku/README.zh-CN.md index f44ececae..d5e7512a8 100644 --- a/src/sku/README.zh-CN.md +++ b/src/sku/README.zh-CN.md @@ -147,6 +147,7 @@ export default { | safe-area-inset-bottom `v2.2.1` | 是否开启[底部安全区适配](#/zh-CN/quickstart#di-bu-an-quan-qu-gua-pei) | *boolean* | `false` | | start-sale-num `v2.3.0` | 起售数量 | *number* | `1` | | properties `v2.4.2` | 商品属性 | *array* | - | +| preview-on-click-image | 是否在点击商品图片时自动预览 | *boolean* | `true` | ### Events diff --git a/src/sku/Sku.js b/src/sku/Sku.js index 4667bec08..b9f45bd0a 100644 --- a/src/sku/Sku.js +++ b/src/sku/Sku.js @@ -91,6 +91,10 @@ export default createComponent({ type: Object, default: () => ({}), }, + previewOnClickImage: { + type: Boolean, + default: true, + }, }, data() { @@ -484,6 +488,8 @@ export default createComponent({ }, onPreviewImage(indexImage) { + const { previewOnClickImage } = this; + const index = this.imageList.findIndex(image => image === indexImage); const params = { @@ -494,6 +500,10 @@ export default createComponent({ this.$emit('open-preview', params); + if (!previewOnClickImage) { + return; + } + ImagePreview({ images: this.imageList, startPosition: index,