当我按下屏幕离子 3 时菜单不起作用 [英] Menu is not working when i push the screen ionic 3
问题描述
我有一个屏幕登录,主页带有菜单,4 个选项卡.像 home、about、location、more
.在这种情况下,菜单工作正常.当我登录时,我使用下面的代码将屏幕导航到带有所有选项卡、菜单的主页.那个时候它工作正常.
this.navCtrl.push(TabsPage);
当我在 about
屏幕时.我有一个按钮来显示一些数据,当用户按下确定按钮时,它将显示一个带有一些分数数据的屏幕:
这是屏幕代码:
<ion-header><ion-navbar 颜色=navcolr";无边框底部><ion-title>考试成绩</ion-title></离子导航栏></离子头><离子内容填充全屏><ion-card style="宽度:91%;">上面的这个屏幕将是一个 modalCtrl
.所以上面你可以看到cancel
按钮就知道了.一旦我按下它,它将转到点击页面.
这里是代码:
cancelBtn() {//this.navCtrl.setRoot(TabsPage);this.navCtrl.push(TabsPage);}
所以它会带着所有菜单图标进入我的主页,点击图标...但是标签正在工作.
更新:
我尝试使用 dismiss viewcontroller
但它只关闭视图,所以仍然在我的问题页面中.....但我需要转到我的 tabspage
...我该怎么做?
解决方案 在模态页面中
从 'ionic-angular' 导入 {ViewController};
...
构造函数(私有视图:ViewController) {}
...
closeModal() {//关闭模态的处理程序.this.view.dismiss();}
I have one screen login with home comes with menu, 4 tabs . Like home, about, location, more
.And in this case menu working fine. When i login, i use this below code to navigate the screen to home pagewith all tabs , menu. That time its working fine.
this.navCtrl.push(TabsPage);
And when i am in about
screen . I have one button to show some data and when user press ok button it will show one screen with some score data:
this is that screen code:
<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>
This above screen will be a modalCtrl
. So above you can see cancel
buton know. Once i press that it will go to taps pages.
Here that code :
cancelBtn() {
//this.navCtrl.setRoot(TabsPage);
this.navCtrl.push(TabsPage);
}
So its going to my home page with all menu icon, tap icon... But tabs are working.
updated:
I tried with dismiss viewcontroller
But its dismiss only the view , so that still in my question page.....but i need to go to my tabspage
...How can i do this ?
解决方案 in modal page
import {ViewController} from 'ionic-angular';
...
constructor(
private view: ViewController
) {}
...
closeModal() { //handler to close modal.
this.view.dismiss();
}
这篇关于当我按下屏幕离子 3 时菜单不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文