显示除登录页面之外的选项卡菜单?
Show Tabs menu except Login Page?
我在 app.component.ts 中将登录页面设置为根页面。登录成功后导航到主页。
在这种情况下,选项卡菜单不显示主页。但我只需要在主页中显示菜单而不是在登录页面中。请帮助我。
import { Component } from '@angular/core';
import { Platform } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import { TabsPage } from '../pages/tabs/tabs';
import { LoginPage } from '../pages/login/login';
@Component({
templateUrl: 'app.html'
})
export class MyApp {
rootPage:any = LoginPage;
constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) {
platform.ready().then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
statusBar.styleDefault();
splashScreen.hide();
});
}
}
有太多方法可以做到这一点,
例如,在登录页面中,您可以使用本机存储来存储登录令牌。
this.storage.set('token',YourLoginData);
在您的 app.component.ts 构造函数中获取存储值:
this.storage.get('token').then(res=>{
if(res){
this.rootPage=HomePage;
this.pages =[
{ title: 'HOME', component: HomePage },
//..... ALL PAGES YOU WANT
];
}else{ this.rootPage=LoginPage}
});
我在 app.component.ts 中将登录页面设置为根页面。登录成功后导航到主页。 在这种情况下,选项卡菜单不显示主页。但我只需要在主页中显示菜单而不是在登录页面中。请帮助我。
import { Component } from '@angular/core';
import { Platform } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import { TabsPage } from '../pages/tabs/tabs';
import { LoginPage } from '../pages/login/login';
@Component({
templateUrl: 'app.html'
})
export class MyApp {
rootPage:any = LoginPage;
constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) {
platform.ready().then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
statusBar.styleDefault();
splashScreen.hide();
});
}
}
有太多方法可以做到这一点, 例如,在登录页面中,您可以使用本机存储来存储登录令牌。
this.storage.set('token',YourLoginData);
在您的 app.component.ts 构造函数中获取存储值:
this.storage.get('token').then(res=>{
if(res){
this.rootPage=HomePage;
this.pages =[
{ title: 'HOME', component: HomePage },
//..... ALL PAGES YOU WANT
];
}else{ this.rootPage=LoginPage}
});