mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-05 19:41:45 +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 Scroller = (
|
||||
@ -38,7 +38,9 @@ export const pageScrollMixin = (scroller: Scroller) =>
|
||||
|
||||
detached() {
|
||||
const page = getCurrentPage<{ vanPageScroller: Scroller[] }>();
|
||||
page.vanPageScroller =
|
||||
page.vanPageScroller?.filter((item) => item !== scroller) || [];
|
||||
if (!isDef(page)) {
|
||||
page.vanPageScroller =
|
||||
page.vanPageScroller?.filter((item) => item !== scroller) || [];
|
||||
}
|
||||
},
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user