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']?.()] )} (