From cc2a40450ecf127cbe95badeb3c9815db758bd36 Mon Sep 17 00:00:00 2001 From: neverland Date: Wed, 22 Sep 2021 16:01:51 +0800 Subject: [PATCH] fix(Tabs): failed to scroll into view when render multiple tabs (#9542) --- src/tabs/utils.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/tabs/utils.ts b/src/tabs/utils.ts index 26c8ef2d3..0bd6b78ab 100644 --- a/src/tabs/utils.ts +++ b/src/tabs/utils.ts @@ -1,15 +1,11 @@ -import { raf, cancelRaf } from '../utils/dom/raf'; +import { raf } from '../utils/dom/raf'; import { getScrollTop, setScrollTop } from '../utils/dom/scroll'; -let scrollLeftRafId: number; - export function scrollLeftTo( scroller: HTMLElement, to: number, duration: number ) { - cancelRaf(scrollLeftRafId); - let count = 0; const from = scroller.scrollLeft; const frames = duration === 0 ? 1 : Math.round((duration * 1000) / 16); @@ -18,7 +14,7 @@ export function scrollLeftTo( scroller.scrollLeft += (to - from) / frames; if (++count < frames) { - scrollLeftRafId = raf(animate); + raf(animate); } }