@wikala/spmkt 2.19.1 → 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.
@@ -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
- <figure class="image">
17
- <img :src="image.url" />
18
- </figure>
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
- <figure v-else class="no-image">
36
- <img :src="product.thumb_url" style="max-width: unset" />
37
- </figure>
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>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wikala/spmkt",
3
- "version": "2.19.1",
3
+ "version": "2.20.0",
4
4
  "private": false,
5
5
  "description": "supermarket",
6
6
  "scripts": {