繁体   English   中英

从弹出窗口导航到页面时,在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);

如代码时间轴中所示,将调用一个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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM