@wikala/spmkt 2.19.0 → 2.20.0
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.
|
@@ -61,7 +61,7 @@ export default {
|
|
|
61
61
|
setProducts(products) {
|
|
62
62
|
this.products = products
|
|
63
63
|
this.setAttTemplateId()
|
|
64
|
-
Cookie.set('compareList', this.products, { expires: 1 })
|
|
64
|
+
Cookie.set('compareList', JSON.stringify(this.products), { expires: 1 })
|
|
65
65
|
},
|
|
66
66
|
|
|
67
67
|
addProduct(product) {
|
|
@@ -81,7 +81,7 @@ export default {
|
|
|
81
81
|
this.products.push(product)
|
|
82
82
|
this.setCompareIconStatus(product.id, 'on')
|
|
83
83
|
this.setAttTemplateId()
|
|
84
|
-
Cookie.set('compareList', this.products, { expires: 1 })
|
|
84
|
+
Cookie.set('compareList', JSON.stringify(this.products), { expires: 1 })
|
|
85
85
|
},
|
|
86
86
|
|
|
87
87
|
compare() {
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
with-carousel-list
|
|
14
14
|
>
|
|
15
15
|
<b-carousel-item v-for="(image, i) in product.images" :key="i">
|
|
16
|
-
<
|
|
17
|
-
<img :src="image.url"
|
|
18
|
-
</
|
|
16
|
+
<picture class="image">
|
|
17
|
+
<img loading="lazy" :src="image.url" :srcset="getSrcset(image)" decoding="async" sizes="100vw">
|
|
18
|
+
</picture>
|
|
19
19
|
</b-carousel-item>
|
|
20
|
-
<span v-if="gallery" @click="switchGallery(false)" class="modal-close is-large"
|
|
20
|
+
<span v-if="gallery" @click="switchGallery(false)" class="modal-close is-large"></span>
|
|
21
21
|
<template slot="list" slot-scope="props" v-if="product.images.length > 1">
|
|
22
22
|
<b-carousel-list
|
|
23
23
|
v-model="props.active"
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
/>
|
|
33
33
|
</template>
|
|
34
34
|
</b-carousel>
|
|
35
|
-
<
|
|
36
|
-
<img :src="product.thumb_url" style="max-width: unset"
|
|
37
|
-
</
|
|
35
|
+
<picture v-else class="no-image">
|
|
36
|
+
<img :src="product.thumb_url" style="max-width: unset">
|
|
37
|
+
</picture>
|
|
38
38
|
</div>
|
|
39
39
|
</div>
|
|
40
40
|
</template>
|
|
@@ -98,6 +98,15 @@ export default {
|
|
|
98
98
|
return [original.slice(0, lastDotPosition), '-' + resolution, original.slice(lastDotPosition)].join('')
|
|
99
99
|
},
|
|
100
100
|
|
|
101
|
+
getSrcset(imgdata) {
|
|
102
|
+
if(!imgdata.available_sizes) return
|
|
103
|
+
let srcset = []
|
|
104
|
+
imgdata.available_sizes.forEach(asize => {
|
|
105
|
+
srcset.push(`${asize.url} ${asize.width}w`)
|
|
106
|
+
})
|
|
107
|
+
return srcset.join(', ')
|
|
108
|
+
},
|
|
109
|
+
|
|
101
110
|
switchGallery(value) {
|
|
102
111
|
if (this.$mq === 'mobile') {
|
|
103
112
|
this.gallery = false
|
|
@@ -117,14 +126,11 @@ export default {
|
|
|
117
126
|
this.$emit('update', window.wkl_product)
|
|
118
127
|
}
|
|
119
128
|
this.$bus.$on('changePhoto', (photoId) => {
|
|
120
|
-
//console.log('changePhoto', photoId, this.product.images)
|
|
121
129
|
let imageIndex = _.findIndex(this.product?.images, { id: photoId })
|
|
122
130
|
if (imageIndex >= 0) {
|
|
123
131
|
this.activeImage = imageIndex
|
|
124
132
|
}
|
|
125
|
-
//console.log('found: ', imageIndex)
|
|
126
133
|
})
|
|
127
|
-
//console.log('mounted ', window.wkl_product.images)
|
|
128
134
|
}
|
|
129
135
|
}
|
|
130
136
|
</script>
|