Skip to content

Commit 4681580

Browse files
authored
Merge pull request #619 from hy916/dev
fix(Swiper): 解决Swiper组件第一次进入从第一张图滑反向滑到最后一张图,最后一张图片没显示的问题
2 parents 0a6070f + 095b140 commit 4681580

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packages/core/src/Swiper/index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ const Swiper = (porps: SwiperProps) => {
5858
if (scrollToRef && scrollToRef.current && index !== 0) {
5959
setCurIndex(index);
6060
scrollToRef.current.scrollTo({ x: width * index, y: 0, animated: false });
61+
} else if (scrollToRef && scrollToRef.current && index === 0) {
62+
setCurIndex(index);
63+
scrollToRef.current.scrollTo({ x: dataSource.length * width, y: 0, animated: false });
6164
}
6265
};
6366

0 commit comments

Comments
 (0)