From 9f487c3eb8ef793930863b28fb82a63d0546a6c8 Mon Sep 17 00:00:00 2001 From: fennghuang <89014758+fennghuang@users.noreply.github.com> Date: Fri, 20 Oct 2023 06:03:17 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=9B=BE=E7=89=87=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E6=8B=96=E6=8B=BD=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + src/image-viewer/image-viewer.vue | 315 ++++++++++++++++-------------- src/shared/index.ts | 1 + src/shared/useGesture/index.ts | 89 +++++++++ src/swiper/swiper.vue | 47 ++--- 5 files changed, 281 insertions(+), 172 deletions(-) create mode 100644 src/shared/useGesture/index.ts diff --git a/package.json b/package.json index 9caf4cbc8..2e5bc5fb8 100644 --- a/package.json +++ b/package.json @@ -86,6 +86,7 @@ "@babel/runtime": "^7.16.5", "@types/lodash": "^4.14.178", "@types/validator": "^13.6.3", + "@use-gesture/vanilla": "^10.3.0", "@vueuse/core": "^8.2.5", "dayjs": "^1.10.7", "lodash": "^4.17.21", diff --git a/src/image-viewer/image-viewer.vue b/src/image-viewer/image-viewer.vue index 93fb32be6..3f871a823 100644 --- a/src/image-viewer/image-viewer.vue +++ b/src/image-viewer/image-viewer.vue @@ -3,6 +3,7 @@
@@ -30,7 +30,9 @@
-
{{ (currentIndex ?? 0) + 1 }}/{{ images?.length }}
+
+ {{ Math.min((currentIndex ?? 0) + 1, images?.length) }}/{{ images?.length }} +
@@ -41,13 +43,24 @@