【问题标题】:this.navCtrl.parent.select() is not working with super-tabsthis.navCtrl.parent.select() 不适用于超级选项卡
【发布时间】:2018-03-28 14:52:13
【问题描述】:

我在 Ionic3 中实现了可滑动的标签,效果很好。我想知道如何从ChatsPage 中选择ContactPage(两者都是super-tabs 中的单独选项卡)。 this.navCtrl.parent.select(0) 不适用于 super-tabs

    <super-tabs tabsHighlight="true" tabsPlacement="top" [selectedTabIndex]="mySelectedIndex" >
    <super-tab [root]="contactsRoot" title="My Team" ></super-tab>
    <super-tab [root]="chatsRoot" title="Chats" ></super-tab>
    <super-tab [root]="callsRoot" title="Call Log" ></super-tab>
</super-tabs>

对此有什么想法吗?

【问题讨论】:

  • 如果有人有同样的问题,请分享他们的想法

标签: ionic3


【解决方案1】:

我终于从https://github.com/zyra/ionic2-super-tabs/issues/265#issuecomment-376225616得到了解决方案

解决方案

您需要在我们的标签页中注入SuperTabsController,然后从那里调用slideTo

export class ChatsRootPage {
   constructor(private superTabs : SuperTabsController) {}

   goToContacts(){
      this.superTabs.slideTo(0, 'mainTabs'); // 0 is the index of contactsRoot tab and mainTabs is the id of your super-tabs component.
   }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-15
    • 2022-01-18
    • 2014-12-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多