Вкладки на главной странице - PullRequest
0 голосов
/ 26 апреля 2018

я пытаюсь сделать вкладки на моей домашней странице, но страница не загружается, когда я помещаю домашнюю страницу в качестве выбранного индекса на вкладках, вот мой код:

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();
    });
  }
}

1 Ответ

0 голосов
/ 26 апреля 2018

Создать новую страницу TabsPage.

// Tabs.ts

export class TabsPage{
public isConnected: Boolean= true;

homeRoot = HomePage;
aRoot = SigninPage;
bRoot = SignupPage;

// Tabs.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.component.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();
    });
  }
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...