From 9110198ed11116b05bab16c6ddb5d7e30cd3b547 Mon Sep 17 00:00:00 2001 From: qzhuo Date: Thu, 18 Jul 2024 13:48:54 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20tabs=E7=BB=84=E4=BB=B6=E8=81=9A=E7=84=A6?= =?UTF-8?q?=E6=BB=9A=E5=8A=A8=E6=96=B9=E6=B3=95=E5=BC=82=E5=B8=B8=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=EF=BC=88#662=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/vantui/src/tabs/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/vantui/src/tabs/index.tsx b/packages/vantui/src/tabs/index.tsx index 09cb627a..7281f3e3 100644 --- a/packages/vantui/src/tabs/index.tsx +++ b/packages/vantui/src/tabs/index.tsx @@ -202,10 +202,10 @@ export function Tabs(props: TabsProps) { } const scrollIntoView = function (index?: number) { - if (!scrollable) { + index = index ?? currentIndex + if (!scrollable || index === undefined) { return } - index = index ?? currentIndex Promise.all([ getAllRect(null, `.tabs-com-index${indexRef.current} .van-tab`), getRect(null, `.tabs-com-index${indexRef.current} .van-tabs__nav`),