如何在Back Button Ionic2上跳过先前的视图

  • 本文关键字:视图 Back Button Ionic2 ionic2
  • 更新时间 :
  • 英文 :


我正在使用Ionic2。我有很少的页面,例如

p1-> p2-> p3-> p4

当我按P4上的返回按钮或使用Navctrl.pop((时,它将转到P3。但是如果满足某些条件,我想获得P2。Ionic2中是否有可能跳过立即的先前视图。我不能将P2设置为P4 BACK按钮上的根。应该从后部历史记录中删除P3。

在组件类中尝试此代码

@ViewChild(Navbar) navBar: Navbar;
ionViewDidLoad() {
   this.navBar.backButtonClick = (e: UIEvent) => {
       if(condition)  //put your condition here
           this.navController.remove(2); //if you want to skip P3
       this.navController.pop();
   }
}

相关内容

最新更新