feat(Sku): add preview-on-click-image prop (#5684)

This commit is contained in:
landluck
2020-02-19 15:48:40 +08:00
committed by GitHub
parent 02afe720c6
commit 7154afb36f
3 changed files with 12 additions and 0 deletions
+10
View File
@@ -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,