【发布时间】:2016-11-25 08:31:19
【问题描述】:
如果我从弹出窗口导航到 Ionic2 页面,Ionic2 会禁用滚动,问题详情如下:
我有 3 页,其中一页是包含此代码的时间线:
let popover = Popover.create(ItemListPage, {items: data.data});
this.nav.present(popover);
如代码时间线所示调用了一个popover:ItemList,里面有这样的代码:
close() {
this.viewCtrl.dismiss();
}
showUserProfile(user){
this.close(); //I added this line to check if the popover is the reason
this.nav.push(UserProfilePage, { userToShow: user});
}
如代码所示,当popover中的item发生点击事件时,会调用showUserProfile函数,关闭popover(我只添加了这一行来检查popover是否是错误的原因) ,然后导航到另一个页面:UserProfilePage。
在 UserProfile 页面中,我有一个滚动条,当我从 itemListPage 弹出框导航到 UserProfilePage 时,它在所有情况下都可以正常工作,除了这个。在这种情况下,滚动条仅在我更换 this.nav.push(UserProfilePage, { userToShow: user});
与
this.nav.setRoot(UserProfilePage, { userToShow: user});
我不确定为什么会发生这种情况,我可以做些什么来解决它。 PS:我不想关闭弹窗,我想让用户回到它,我只是添加它来检查错误原因。
【问题讨论】:
-
能否将您的代码添加到working plunker?
-
@Vanddel 已回答here
标签: typescript angular ionic2