From 1875716e39d7b38d0d5df342c058d5927cfd34e5 Mon Sep 17 00:00:00 2001 From: luyongfang Date: Wed, 8 Jan 2025 13:15:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dchildren=E5=8F=98=E5=8C=96?= =?UTF-8?q?=E6=97=B6=E5=BD=93=E5=89=8D=E6=BB=9A=E5=8A=A8=E5=88=B0=E7=9A=84?= =?UTF-8?q?=E7=B4=A2=E5=BC=95=E4=BD=8D=E7=BD=AE=E5=A4=A7=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lib/runtime/components/react/mpx-swiper.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/webpack-plugin/lib/runtime/components/react/mpx-swiper.tsx b/packages/webpack-plugin/lib/runtime/components/react/mpx-swiper.tsx index 89884a08e0..bbbeef12e3 100644 --- a/packages/webpack-plugin/lib/runtime/components/react/mpx-swiper.tsx +++ b/packages/webpack-plugin/lib/runtime/components/react/mpx-swiper.tsx @@ -395,6 +395,16 @@ const SwiperWrapper = forwardRef, SwiperProps>((pr runOnJS(handleSwiperChange)(newIndex) } }) + + useEffect(() => { + if (childrenLength - 1 < currentIndex.value) { + pauseLoop() + currentIndex.value = 0 + offset.value = getOffset(0, step.value) + resumeLoop() + } + },[childrenLength]) + useEffect(() => { if (!step.value) { return