@wikala/spmkt 2.19.1 → 2.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -13,11 +13,17 @@
|
|
|
13
13
|
with-carousel-list
|
|
14
14
|
>
|
|
15
15
|
<b-carousel-item v-for="(image, i) in product.images" :key="i">
|
|
16
|
-
<
|
|
17
|
-
<img
|
|
18
|
-
|
|
16
|
+
<picture class="image">
|
|
17
|
+
<img
|
|
18
|
+
loading="lazy"
|
|
19
|
+
:src="image.url"
|
|
20
|
+
:srcset="getSrcset(image)"
|
|
21
|
+
decoding="async"
|
|
22
|
+
sizes="100vw"
|
|
23
|
+
style="max-height: calc(100vh - 100px);">
|
|
24
|
+
</picture>
|
|
19
25
|
</b-carousel-item>
|
|
20
|
-
<span v-if="gallery" @click="switchGallery(false)" class="modal-close is-large"
|
|
26
|
+
<span v-if="gallery" @click="switchGallery(false)" class="modal-close is-large"></span>
|
|
21
27
|
<template slot="list" slot-scope="props" v-if="product.images.length > 1">
|
|
22
28
|
<b-carousel-list
|
|
23
29
|
v-model="props.active"
|
|
@@ -32,9 +38,9 @@
|
|
|
32
38
|
/>
|
|
33
39
|
</template>
|
|
34
40
|
</b-carousel>
|
|
35
|
-
<
|
|
36
|
-
<img :src="product.thumb_url" style="max-width: unset"
|
|
37
|
-
</
|
|
41
|
+
<picture v-else class="no-image">
|
|
42
|
+
<img :src="product.thumb_url" style="max-width: unset">
|
|
43
|
+
</picture>
|
|
38
44
|
</div>
|
|
39
45
|
</div>
|
|
40
46
|
</template>
|
|
@@ -98,6 +104,15 @@ export default {
|
|
|
98
104
|
return [original.slice(0, lastDotPosition), '-' + resolution, original.slice(lastDotPosition)].join('')
|
|
99
105
|
},
|
|
100
106
|
|
|
107
|
+
getSrcset(imgdata) {
|
|
108
|
+
if(!imgdata.available_sizes) return
|
|
109
|
+
let srcset = []
|
|
110
|
+
imgdata.available_sizes.forEach(asize => {
|
|
111
|
+
srcset.push(`${asize.url} ${asize.width}w`)
|
|
112
|
+
})
|
|
113
|
+
return srcset.join(', ')
|
|
114
|
+
},
|
|
115
|
+
|
|
101
116
|
switchGallery(value) {
|
|
102
117
|
if (this.$mq === 'mobile') {
|
|
103
118
|
this.gallery = false
|
|
@@ -117,14 +132,11 @@ export default {
|
|
|
117
132
|
this.$emit('update', window.wkl_product)
|
|
118
133
|
}
|
|
119
134
|
this.$bus.$on('changePhoto', (photoId) => {
|
|
120
|
-
//console.log('changePhoto', photoId, this.product.images)
|
|
121
135
|
let imageIndex = _.findIndex(this.product?.images, { id: photoId })
|
|
122
136
|
if (imageIndex >= 0) {
|
|
123
137
|
this.activeImage = imageIndex
|
|
124
138
|
}
|
|
125
|
-
//console.log('found: ', imageIndex)
|
|
126
139
|
})
|
|
127
|
-
//console.log('mounted ', window.wkl_product.images)
|
|
128
140
|
}
|
|
129
141
|
}
|
|
130
142
|
</script>
|