From 327e639041297b2f8382ee8eaf87a47145950a3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B9=A6=E8=BE=B0?= <98034133+ShuchenEason@users.noreply.github.com> Date: Fri, 21 Jun 2024 17:57:55 +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=20(#2369)?= 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') {