From 0af63888355bff4bd87c444b8e5244e7e816138d Mon Sep 17 00:00:00 2001 From: DCloud_LXH <283700113@qq.com> Date: Tue, 30 Nov 2021 14:16:53 +0800 Subject: [PATCH] fix: swiper switch --- packages/uni-components/src/components/swiper/index.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/uni-components/src/components/swiper/index.tsx b/packages/uni-components/src/components/swiper/index.tsx index ceb303848..0636fe426 100644 --- a/packages/uni-components/src/components/swiper/index.tsx +++ b/packages/uni-components/src/components/swiper/index.tsx @@ -296,6 +296,9 @@ function useLayout( for (; position + length < current; ) { position += length } + if (position + length - current < current - position) { + position += length + } } else { for (; position + length < current; ) { position += length @@ -335,9 +338,11 @@ function useLayout( : 0 } animateViewport(state.current, 'autoplay', circularEnabled.value ? 1 : 0) + // @ts-ignore setTimeout -> NodeJS.Timeout timer = setTimeout(callback, state.interval) } if (!(invalid || items.length <= state.displayMultipleItems)) { + // @ts-ignore setTimeout -> NodeJS.Timeout timer = setTimeout(callback, state.interval) } } -- GitLab