this.navCtrl.parent.select() is not working with super-tabs

我与影子孤独终老i 提交于 2019-12-10 22:14:31

问题


I have implemented swipeable tabs in Ionic3 which works perfectly. I want to know how to select ContactPage from ChatsPage (both are individual tabs in super-tabs). this.navCtrl.parent.select(0) is not working with 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>

Any idea on this?


回答1:


Finally I got the solution from https://github.com/zyra/ionic2-super-tabs/issues/265#issuecomment-376225616

Solution

You need to inject SuperTabsController in our tab pages and from there call 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.
   }
}


来源:https://stackoverflow.com/questions/49492197/this-navctrl-parent-select-is-not-working-with-super-tabs

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!