@wikala/spmkt 2.25.1 → 2.25.3

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.
@@ -62,7 +62,7 @@ export default {
62
62
  container: this.$el
63
63
  })
64
64
 
65
- this.itemQty = parseInt(qty)
65
+ this.itemQty = Number(qty)
66
66
 
67
67
  let requestData = {
68
68
  id: productId,
@@ -90,7 +90,6 @@ export default {
90
90
  this.setCart(response.data)
91
91
  } catch (error) {
92
92
  cqLoading.close()
93
- //console.log(err)
94
93
 
95
94
  let serverErrors = []
96
95
  if (error.errors) {
@@ -12,6 +12,8 @@
12
12
  </template>
13
13
 
14
14
  <script>
15
+ import Price from '../Product/Price.vue';
16
+
15
17
  export default {
16
18
  name: 'LoadMore',
17
19
  props: {
@@ -44,28 +46,30 @@ export default {
44
46
 
45
47
  const url = new URL(window.location.href);
46
48
  url.searchParams.set('page', this.currentPage);
47
- url.searchParams.set('partial', '1');
48
-
49
- const response = await fetch(url);
50
- console.log("response.status =", response.status);
51
-
52
- const html = await response.text();
49
+ url.searchParams.set('partial', '1')
53
50
 
54
- const temp = document.createElement('div');
55
- temp.innerHTML = html;
51
+ const response = await fetch(url)
52
+ const html = await response.text()
53
+
54
+ const temp = document.createElement('div')
55
+ temp.innerHTML = html
56
56
 
57
- const categoryProducts = this.$el.closest('.category-products').firstChild
58
- const newProducts = temp.querySelectorAll('.prod-box-container');
59
- newProducts.forEach(element => {
60
- categoryProducts.appendChild(element);
57
+ const loadMoreContainer = this.$el.closest('.load-more-container')
58
+ loadMoreContainer.insertAdjacentElement('beforebegin', temp)
59
+
60
+ //We need to initialize and mount all Vue components inside fetched content
61
+ const FetchedContent = Vue.extend({
62
+ template: temp.innerHTML,
63
+ components: { Price }
61
64
  });
65
+ new FetchedContent().$mount(temp);
62
66
  } catch (error) {
63
- console.error('Error loading more content:', error);
67
+ console.error('Error loading more content:', error)
64
68
  } finally {
65
69
  this.isLoading = false;
66
70
  if(this.currentPage === this.totalPages) {
67
- this.hasMoreContent = false;
68
- return;
71
+ this.hasMoreContent = false
72
+ return
69
73
  }
70
74
  }
71
75
  }
@@ -5,7 +5,7 @@
5
5
  <option value="smp">{{ selectMax + 1 }}+</option>
6
6
  </select>
7
7
  <form @submit.prevent="qtyUpdate">
8
- <input v-if="!showSelect" class="input" type="number" @input="qtyInput" :value="qty" />
8
+ <input ref="textInput" v-if="!showSelect" class="input" type="number" @input="qtyInput" :value="qty" />
9
9
  <button v-if="showUpdateButton" class="button is-small" style="width: 100%">{{ $t('global.update') }}</button>
10
10
  </form>
11
11
  </div>
@@ -60,6 +60,9 @@ export default {
60
60
  watch: {
61
61
  value: function (nv, ov) {
62
62
  this.qty = nv
63
+ if (this.qty > this.selectMax) {
64
+ this.showSelect = false
65
+ }
63
66
  }
64
67
  },
65
68
 
@@ -82,7 +85,7 @@ export default {
82
85
  this.showSelect = false
83
86
  this.showUpdateButton = true
84
87
  setTimeout(() => {
85
- event.path[1].childNodes[2].childNodes[0].focus()
88
+ this.$refs.textInput.focus()
86
89
  }, 100)
87
90
  } else {
88
91
  this.$emit('input', event.target.value)
@@ -93,13 +96,6 @@ export default {
93
96
  this.showUpdateButton = false
94
97
  this.$emit('input', this.qty)
95
98
  }
96
- },
97
-
98
- mounted() {
99
- this.qty = this.value
100
- if (this.qty > this.selectMax) {
101
- this.showSelect = false
102
- }
103
- }
99
+ }
104
100
  }
105
101
  </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wikala/spmkt",
3
- "version": "2.25.1",
3
+ "version": "2.25.3",
4
4
  "private": false,
5
5
  "description": "supermarket",
6
6
  "scripts": {