【问题标题】:Menu is not working when i push the screen ionic 3当我按下屏幕离子 3 时菜单不起作用
【发布时间】:2017-10-29 21:22:54
【问题描述】:

我有一个屏幕登录,主页带有菜单,4 个选项卡。就像home, about, location, more。在这种情况下,菜单工作正常。当我登录时,我使用下面的代码将屏幕导航到带有所有选项卡、菜单的主页。那个时候它工作正常。

 this.navCtrl.push(TabsPage);

当我在 about 屏幕时。我有一个按钮来显示一些数据,当用户按下确定按钮时,它将显示一个带有一些分数数据的屏幕:

这是屏幕代码:

<ion-header>
  <ion-navbar color="navcolr" no-border-bottom>
    <ion-title >Exam Score</ion-title>
  </ion-navbar>
</ion-header>
<ion-content padding fullscreen>

      <ion-card style="width: 91%;">

      <div style="font-size: 20px;text-align: center;">
        <span>Your Score : {{this.correctans}}</span>
      </div>
       
      </ion-card>
   
      <button ion-button style="width: 152px !important;margin-left: 23%;" (click)="cancelBtn()">CANCEL</button>

</ion-content>

上面的屏幕将是 modalCtrl 。所以上面你可以看到cancelbutton就知道了。一旦我按下它,它将转到点击页面。

这里是代码:

cancelBtn() {
   //this.navCtrl.setRoot(TabsPage);
   this.navCtrl.push(TabsPage);
}

所以它会带着所有菜单图标进入我的主页,点击图标...但是标签正在工作。

更新:

我尝试使用dismiss viewcontroller但它只关闭视图,所以仍然在我的问题页面中.....但我需要转到我的tabspage...我该怎么做?

【问题讨论】:

  • @sebaferreras 请为此提供任何解决方案

标签: angular typescript ionic2 hybrid-mobile-app ionic3


【解决方案1】:

在模态页面中

import {ViewController} from 'ionic-angular';

...

 constructor(
    private view: ViewController
 ) {}

...

closeModal() { //handler to close modal.
    this.view.dismiss();
}

【讨论】:

  • 这对我有用;在转到另一个页面之前,我忘记关闭我的模式。 :)
猜你喜欢
  • 2022-11-14
  • 1970-01-01
  • 1970-01-01
  • 2014-07-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-10
  • 1970-01-01
相关资源
最近更新 更多