From 1837ed712f4b5ec4ee3a6c2520bbbc6842d6e123 Mon Sep 17 00:00:00 2001 From: Alan Wang Date: Fri, 2 Sep 2022 23:01:22 +0800 Subject: [PATCH] fix(indexBar): index-bar not positioned correctly when scrolled to the bottom (#10994) --- packages/vant/src/index-bar/IndexBar.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/vant/src/index-bar/IndexBar.tsx b/packages/vant/src/index-bar/IndexBar.tsx index 902fc6d6a..bdd23002b 100644 --- a/packages/vant/src/index-bar/IndexBar.tsx +++ b/packages/vant/src/index-bar/IndexBar.tsx @@ -221,13 +221,13 @@ export default defineComponent({ const scrollParentRect = useRect(scrollParent); const { offsetHeight } = document.documentElement; + match.$el.scrollIntoView(); + if (scrollTop === offsetHeight - scrollParentRect.height) { onScroll(); return; } - match.$el.scrollIntoView(); - if (props.sticky && props.stickyOffsetTop) { setRootScrollTop(getRootScrollTop() - props.stickyOffsetTop); }