0

我们如何创建类似堆栈的结构来导航页面,以便我们可以从同一页面创建页面的新对象,这里我想从 SuperPage 转到 SuperPage 但角度路由不支持它,在 IONIC3 中我们可以很容易地实现它navCtrl 的 push 方法,但我想在 ionic 4 中的同一页面(SuperPage)上导航,那么我们该如何实现呢?

import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { NavController } from '@ionic/angular';

@Component({
  selector: 'app-super',
  templateUrl: './super.page.html',
  styleUrls: ['./super.page.scss'],
})
export class SuperPage implements OnInit {
  constructor(private router: Router, private navCtrl: NavController) { }
  nextPage() {
    //working in ionic3
    //this.navCtrl.push('SuperPage');

    //ionic4
    //1.not working 
    //this.navCtrl.navigateForward('super');

    //2.not working
    //this.navCtrl.navigateRoot('super');

    //3.not working
    // this.router.navigate(['super']);

      this.router.navigateByUrl('super');
  }


}
4

1 回答 1

0

以上问题有两种解法

1) 模态页面

您可以像 modal 一样调用页面,我们的 modal 页面将显示在我们的超级页面上方,我们可以将信息传递给页面,现在我们可以像在 ionic v3 中一样访问这些信息。

https://ionicframework.com/docs/api/modal

2)弹出页面

您可以尝试 Popover 页面,它在技术上与模态一样工作。

https://ionicframework.com/docs/api/popover

我认为您可以使用 Modal

于 2019-06-27T06:19:11.637 回答