fix: totals

This commit is contained in:
Nikita Kiselev
2025-07-23 19:39:50 +03:00
parent f5cac7d566
commit eb1f1dc9c1
3 changed files with 59 additions and 36 deletions

View File

@@ -10,6 +10,7 @@
:navigation="true"
:modules="modules"
class="mySwiper w-full min-h-[200px]"
@touchMove="onTouchMove"
>
<swiper-slide v-for="image in images">
<img
@@ -34,6 +35,7 @@ import 'swiper/css/pagination';
import {Pagination} from 'swiper/modules';
export default {
components: {
Swiper,
@@ -48,12 +50,37 @@ export default {
},
setup() {
const throttle = (func, delay) => {
let lastCall = 0;
return (...args) => {
const now = Date.now();
if (now - lastCall >= delay) {
lastCall = now;
func(...args);
}
};
};
const hapticTick = throttle(() => {
const haptic = window?.Telegram?.WebApp?.HapticFeedback;
if (haptic?.selectionChanged) {
haptic.selectionChanged();
} else if (haptic?.impactOccurred) {
haptic.impactOccurred('light');
}
}, 100);
const onTouchMove = () => {
hapticTick();
};
return {
pagination: {
clickable: true,
dynamicBullets: true,
},
modules: [Pagination],
onTouchMove, // ← вот это добавь
};
},
};