当我从弹出窗口导航到页面时,ionic2 中的滚动被禁用
scrolling in ionic2 is disabled when I navigate from a popover to a page
如果我从弹出窗口导航到页面,Ionic2 会禁用页面滚动,问题详情如下:
我有 3 个页面,其中一个是时间轴,其中包含以下代码:
let popover = Popover.create(ItemListPage, {items: data.data});
this.nav.present(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: 我不想关闭popover,我想让用户回到它,我只是添加它来检查错误原因。
this.viewCtrl.dismiss(); returns一个承诺,所以正确的用法应该是:
close() {
return this.viewCtrl.dismiss();
}
showUserProfile(user){
this.close().then(data =>{
this.nav.push(UserProfilePage, { userToShow: user});
});
}
如果我从弹出窗口导航到页面,Ionic2 会禁用页面滚动,问题详情如下:
我有 3 个页面,其中一个是时间轴,其中包含以下代码:
let popover = Popover.create(ItemListPage, {items: data.data});
this.nav.present(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: 我不想关闭popover,我想让用户回到它,我只是添加它来检查错误原因。
this.viewCtrl.dismiss(); returns一个承诺,所以正确的用法应该是:
close() {
return this.viewCtrl.dismiss();
}
showUserProfile(user){
this.close().then(data =>{
this.nav.push(UserProfilePage, { userToShow: user});
});
}