如何在Ionic 3中返回多页 [英] How to go back multiple pages in ionic 3
本文介绍了如何在Ionic 3中返回多页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的页面流如下所示:
A->B->C->D
在返回到页面"B"之后,我将以某种方式在页面"D"中执行一项功能. 我该如何实现? 使用.pop()只能返回一页. 使用.push(B)也不是解决方案,因为流程将变为:
Somehow I will do a function in page"D", after it need to go back page"B". How can I achieve that? Using .pop() just can go back one page. Using .push(B) is also not the solution, because the flow will become:
A->B->C->D->B
我想要的解决方案是:
A->B
有人知道如何实现吗?非常感谢.
Anyone know how to achieve it? Thanks a lot.
推荐答案
this.navCtrl.popTo(this.navCtrl.getByIndex(this.navCtrl.length()-(N+1)));
N
是您要返回的页面数.
Where N
is the number of pages that you want to go back.
因此,如果您想返回2页N=2
So if you want to go back 2 pages N=2
这篇关于如何在Ionic 3中返回多页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文