mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
fix(page-scroll): check getCurrentPage is def (#4458)
This commit is contained in:
parent
84113ffd17
commit
69cdf45958
@ -1,4 +1,4 @@
|
|||||||
import { getCurrentPage } from '../common/utils';
|
import { getCurrentPage, isDef } from '../common/utils';
|
||||||
|
|
||||||
type IPageScrollOption = WechatMiniprogram.Page.IPageScrollOption;
|
type IPageScrollOption = WechatMiniprogram.Page.IPageScrollOption;
|
||||||
type Scroller = (
|
type Scroller = (
|
||||||
@ -38,7 +38,9 @@ export const pageScrollMixin = (scroller: Scroller) =>
|
|||||||
|
|
||||||
detached() {
|
detached() {
|
||||||
const page = getCurrentPage<{ vanPageScroller: Scroller[] }>();
|
const page = getCurrentPage<{ vanPageScroller: Scroller[] }>();
|
||||||
page.vanPageScroller =
|
if (!isDef(page)) {
|
||||||
page.vanPageScroller?.filter((item) => item !== scroller) || [];
|
page.vanPageScroller =
|
||||||
|
page.vanPageScroller?.filter((item) => item !== scroller) || [];
|
||||||
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user