@mixd-id/web-scaffold 0.1.230406206 → 0.1.230406207
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.
- package/package.json +1 -1
- package/src/components/Carousel.vue +16 -2
package/package.json
CHANGED
|
@@ -102,14 +102,20 @@ export default{
|
|
|
102
102
|
index: 0,
|
|
103
103
|
timeoutId: null,
|
|
104
104
|
scrollPosition: null,
|
|
105
|
+
swiping: false,
|
|
105
106
|
}
|
|
106
107
|
},
|
|
107
108
|
|
|
108
109
|
mounted(){
|
|
110
|
+
window.addEventListener('touchmove', this.onTouchMove, { passive: false });
|
|
109
111
|
if(this.autoPlay > 0)
|
|
110
112
|
this.play()
|
|
111
113
|
},
|
|
112
114
|
|
|
115
|
+
unmounted() {
|
|
116
|
+
window.removeEventListener('touchmove', this.onTouchMove, { passive: false });
|
|
117
|
+
},
|
|
118
|
+
|
|
113
119
|
watch:{
|
|
114
120
|
|
|
115
121
|
index(to){
|
|
@@ -125,6 +131,14 @@ export default{
|
|
|
125
131
|
|
|
126
132
|
methods:{
|
|
127
133
|
|
|
134
|
+
onTouchMove(e){
|
|
135
|
+
if(this.swiping && e.cancelable) {
|
|
136
|
+
e.preventDefault();
|
|
137
|
+
e.returnValue = false;
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
|
|
128
142
|
setPosition(noAnimation) {
|
|
129
143
|
if(!this.$refs.inner) return
|
|
130
144
|
|
|
@@ -210,7 +224,7 @@ export default{
|
|
|
210
224
|
}
|
|
211
225
|
else if(Math.abs(dx) > 3){
|
|
212
226
|
this._props['direction'] = 'horizontal'
|
|
213
|
-
this.
|
|
227
|
+
this.swiping = true
|
|
214
228
|
}
|
|
215
229
|
}
|
|
216
230
|
else if(this._props['direction'] === 'horizontal'){
|
|
@@ -237,7 +251,7 @@ export default{
|
|
|
237
251
|
this.setPosition()
|
|
238
252
|
}
|
|
239
253
|
|
|
240
|
-
this.
|
|
254
|
+
this.swiping = false
|
|
241
255
|
}
|
|
242
256
|
|
|
243
257
|
window.removeEventListener('mousemove', this.mouseMove)
|