mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-05 19:41:45 +08:00
fix(tab): fix maximum call stack on scroll (#5125)
This commit is contained in:
parent
71f5e3422f
commit
5b96c7acb0
@ -20,7 +20,6 @@ function onPageScroll(event?: IPageScrollOption) {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
export function pageScrollMixin(scroller: Scroller) {
|
||||
return Behavior({
|
||||
attached(this: WechatMiniprogram.Component.TrivialInstance) {
|
||||
@ -34,7 +33,7 @@ export function pageScrollMixin(scroller: Scroller) {
|
||||
|
||||
const { vanPageScroller = [] } = page;
|
||||
|
||||
if (!vanPageScroller.length && isFunction(page.onPageScroll)) {
|
||||
if (isFunction(page.onPageScroll) && page.onPageScroll !== onPageScroll) {
|
||||
vanPageScroller.push(page.onPageScroll.bind(page));
|
||||
}
|
||||
|
||||
@ -55,7 +54,7 @@ export function pageScrollMixin(scroller: Scroller) {
|
||||
|
||||
const { vanPageScroller } = page;
|
||||
|
||||
const index = vanPageScroller.findIndex(v => v === this._scroller);
|
||||
const index = vanPageScroller.findIndex((v) => v === this._scroller);
|
||||
|
||||
if (index > -1) {
|
||||
page.vanPageScroller.splice(index, 1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user