From 85528ba7820e3d78588553067d2ea32d631ab81a Mon Sep 17 00:00:00 2001 From: liuyusen5 Date: Wed, 19 Jun 2024 17:41:50 +0800 Subject: [PATCH] =?UTF-8?q?fix(tabs):=20=E4=BF=AE=E5=A4=8Dtabs=E5=BC=82?= =?UTF-8?q?=E6=AD=A5=E8=AE=BE=E7=BD=AEtitles=E6=BB=9A=E5=8A=A8=E5=A4=B1?= =?UTF-8?q?=E6=95=88=EF=BC=88#2351=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/packages/tabs/tabs.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/packages/tabs/tabs.tsx b/src/packages/tabs/tabs.tsx index 9309ddb39e..103cbdb4a8 100644 --- a/src/packages/tabs/tabs.tsx +++ b/src/packages/tabs/tabs.tsx @@ -101,10 +101,12 @@ export const Tabs: FunctionComponent> & { const scrollIntoView = (index: number, immediate?: boolean) => { const nav = navRef.current const titleItem = titleItemsRef.current - if (!nav || !titleItem || !titleItem[index]) { + const titlesLength = titles.current.length + const itemLength = titleItemsRef.current.length + if (!nav || !titleItem || !titleItem[itemLength - titlesLength + index]) { return } - const title = titleItem[index] + const title = titleItem[itemLength - titlesLength + index] let to = 0 if (direction === 'vertical') {