我试图在我的HomePage中创建选项卡,但是当我将HomePage作为选定的索引放在选项卡中时,页面并没有加载,下面是我的代码:
home.ts:
...
export class HomePage {
public isConnected: Boolean= true;
homeRoot = HomePage;
aRoot = SigninPage;
bRoot = SignupPage;
...home.html:
///SOME CONTENT
<ion-tabs selectedIndex="0" *ngIf="isConnected">
<ion-tab [root]="homeRoot" tabTitle="Home"></ion-tab>
<ion-tab [root]="aRoot" tabTitle="Home"></ion-tab>
<ion-tab [root]="bRoot" tabTitle="Home"></ion-tab>
</ion-tabs>app.compenents.ts:
//IMPORTS
@Component({
templateUrl: 'app.html'
})
export class MyApp {
rootPage:any = HomePage;
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();
});
}
}发布于 2018-04-26 09:52:43
创建一个新页面TabsPage。
//塔布思
export class TabsPage{
public isConnected: Boolean= true;
homeRoot = HomePage;
aRoot = SigninPage;
bRoot = SignupPage;//Tab.html
<ion-tabs selectedIndex="0" *ngIf="isConnected">
<ion-tab [root]="homeRoot" tabTitle="Home"></ion-tab>
<ion-tab [root]="aRoot" tabTitle="Home"></ion-tab>
<ion-tab [root]="bRoot" tabTitle="Home"></ion-tab>
</ion-tabs>//app.Compent.ts
//IMPORTS
@Component({
templateUrl: 'app.html'
})
export class MyApp {
rootPage:any = TabsPage;
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();
});
}
}https://stackoverflow.com/questions/50039792
复制相似问题