From c4be70c4e8343f925dc6acefccaca413c280b588 Mon Sep 17 00:00:00 2001 From: chenjiahan Date: Mon, 2 Mar 2020 19:41:07 +0800 Subject: [PATCH] fix(Tabs): lock scroll not work when using scrollspy (#5727) --- src/tabs/index.js | 6 +++--- src/tabs/utils.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tabs/index.js b/src/tabs/index.js index c11d02585..d8978f775 100644 --- a/src/tabs/index.js +++ b/src/tabs/index.js @@ -306,16 +306,16 @@ export default createComponent({ if (el) { const to = getElementTop(el, this.scroller) - this.scrollOffset; - this.clickedScroll = true; + this.lockScroll = true; scrollTopTo(this.scroller, to, +this.duration, () => { - this.clickedScroll = false; + this.lockScroll = false; }); } } }, onScroll() { - if (this.scrollspy && !this.clickedScroll) { + if (this.scrollspy && !this.lockScroll) { const index = this.getCurrentIndexOnScroll(); this.setCurrentIndex(index); } diff --git a/src/tabs/utils.ts b/src/tabs/utils.ts index 815193bfc..26c8ef2d3 100644 --- a/src/tabs/utils.ts +++ b/src/tabs/utils.ts @@ -49,7 +49,7 @@ export function scrollTopTo( if ((isDown && current < to) || (!isDown && current > to)) { raf(animate); } else if (callback) { - callback(); + raf(callback as FrameRequestCallback); } }