[英]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);
如代碼時間軸中所示,將調用一個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中的某個項目發生click事件時,將調用showUserProfile函數,它會關閉popover(我只添加了這一行來檢查popover是否是錯誤原因),然后導航到另一個頁面:UserProfilePage。
在UserProfile頁面中,我有一個滾動條,在我從itemListPage彈出窗口導航到UserProfilePage時,在所有情況下都可以正常工作。 在這種情況下,僅當我替換了this.nav.push(UserProfilePage,{userToShow:user})時,滾動條才起作用。
與
this.nav.setRoot(UserProfilePage, { userToShow: user});
我不確定為什么會發生這種情況,以及如何解決該問題。 PS:我不想關閉彈出窗口,我希望用戶返回到它,我只是添加了它以檢查錯誤原因。
this.viewCtrl.dismiss(); 返回承諾,因此正確的用法應該是:
close() {
return this.viewCtrl.dismiss();
}
showUserProfile(user){
this.close().then(data =>{
this.nav.push(UserProfilePage, { userToShow: user});
});
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.