mirror of
https://github.com/youzan/vant.git
synced 2026-01-16 03:03:46 +08:00
fix(Tabs): lock scroll not work when using scrollspy (#5727)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ export function scrollTopTo(
|
||||
if ((isDown && current < to) || (!isDown && current > to)) {
|
||||
raf(animate);
|
||||
} else if (callback) {
|
||||
callback();
|
||||
raf(callback as FrameRequestCallback);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user