【问题标题】:Dynamic ionic 2 tabs动态离子 2 标签
【发布时间】:2017-03-31 17:14:49
【问题描述】:

我正在尝试从 .ts 文件中的数组创建动态选项卡。

我把这个模板作为多标签组件:

<ion-content class="myclass">
  <ion-tabs tabsPlacement="top">
    <ion-tab *ngFor="let tab of tabs" tabTitle="tab.title" [root]="tab.component"></ion-tab>
  </ion-tabs>
</ion-content>

这是我的 multitab.ts 组件:

@Component({
  selector: 'multi-tab',
  templateUrl: 'multitab.html'
})
export class multiTab {

  tabs : any = [];

  constructor() {
      this.tabs.push({title: 'Snacks',  component: Snacks});
      this.tabs.push({title: 'Drinks',  component: Drinks});
      this.tabs.push({title: 'Frozen',  component: Frozen});
  }
}

但我的自定义组件只显示第一个具有所有功能的组件,就像它是单个选项卡/列表而不是离子选项卡。

我正在使用 2.0.0 rc-2 版本的 ionic。

【问题讨论】:

    标签: ionic-framework ionic2


    【解决方案1】:

    我找到了答案,我的标签栏就在标题下方,这就是为什么它似乎没有出现。如果有人也有这个问题,我会发布这个。

    【讨论】:

    • 你如何在你的页面中调用这个“多标签”标签?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-08-07
    • 2017-10-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多