From 4b2e06b34d11f19da31a6fe1811fa9070f007901 Mon Sep 17 00:00:00 2001 From: neverland Date: Wed, 24 Aug 2022 21:32:29 +0800 Subject: [PATCH] fix(Tabs): resize not work for swipeable tabs (#10964) --- packages/vant/src/tabs/Tabs.tsx | 9 ++++++++- packages/vant/src/tabs/TabsContent.tsx | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/vant/src/tabs/Tabs.tsx b/packages/vant/src/tabs/Tabs.tsx index ab0bd770b..f86e89e81 100644 --- a/packages/vant/src/tabs/Tabs.tsx +++ b/packages/vant/src/tabs/Tabs.tsx @@ -125,6 +125,7 @@ export default defineComponent({ const root = ref(); const navRef = ref(); const wrapRef = ref(); + const contentRef = ref(); const id = useId(); const scroller = useScrollParent(root); @@ -477,8 +478,13 @@ export default defineComponent({ const onRendered = (name: Numeric, title?: string) => emit('rendered', name, title); + const resize = () => { + setLine(); + nextTick(() => contentRef.value?.swipeRef.value?.resize()); + }; + useExpose({ - resize: setLine, + resize, scrollTo, }); @@ -514,6 +520,7 @@ export default defineComponent({ [renderHeader(), slots['nav-bottom']?.()] )} (