this.navCtrl.parent.select() 不适用于超级选项卡 [英] this.navCtrl.parent.select() is not working with super-tabs

查看:15
本文介绍了this.navCtrl.parent.select() 不适用于超级选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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>

对此有什么想法吗?

推荐答案

终于从https://github.com/zyra/ionic2-super-tabs/issues/265#issuecomment-376225616

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

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.
   }
}

这篇关于this.navCtrl.parent.select() 不适用于超级选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆