Ionic 3标签仅在一个标签中显示特定的html

时间:2018-10-18 08:42:04

标签: javascript angular typescript ionic-framework

我正在使用Ionic 3标签,并且我希望仅在第一个标签中看到此<ion-fab>

HTML PAGE:

<ion-tabs>
  <ion-tab [root]="tab1Root"></ion-tab> //first tab
  <ion-tab [root]="tab2Root"></ion-tab>
  <ion-tab [root]="tab3Root"></ion-tab>
</ion-tabs>
//Show this only if first tab : 
    <ion-fab ngif="tabIndex = 0"></ion-fab>

1 个答案:

答案 0 :(得分:0)

export class TabsPage {
  // this tells the tabs component which Pages
  // should be each tab's root Page
  tab1Root = Page1;
  tab2Root = Page2;
  tab3Root = Page3;

  constructor() {

  }
}

如果您只想在Page1上显示ion-fab,则只需设置 仅<ion-fab></ion-fab> .html中的Page1标记。