js 页面popTo跳转到指定页面

1.使用popTo方法进行跳转:javascript

this.navCtrl.popTo(this.getViewByName('SpecifiedPage'));

调用如下方法获取指定页面的ViewController java

getViewByName(name: string) {
    let views = this.navCtrl.getViews();
    console.log(views);
    for (let view of views) {
      if (view.name === name) {
        return view;
      }
    }
  }

2.不使用popTo,直接pushthis

this.navCtrl.push(SpecifiedPage);

从指定索引(下面例子指定页面SpecifiedPage的索引为2,即第三个页面)的导航堆栈中删除后面全部的页面code

this.navCtrl.remove(2,this.navCtrl.length()-2);
相关文章
相关标签/搜索