Typescript 提交表单后切换到其他选项卡
当用户单击时,在选项卡之间导航非常有效,而我目前正在做的事情是,在用户提交表单后,我尝试切换到其他选项卡 tabs.htmlTypescript 提交表单后切换到其他选项卡,typescript,ionic2,Typescript,Ionic2,当用户单击时,在选项卡之间导航非常有效,而我目前正在做的事情是,在用户提交表单后,我尝试切换到其他选项卡 tabs.html <ion-tabs [selectedIndex]="{{changTab}}"> <ion-tab tabTitle="Home" [root]="setTab1" tabIcon="home"></ion-tab> <ion-tab tabTitle="Search" [root]="setTab2" tab
<ion-tabs [selectedIndex]="{{changTab}}">
<ion-tab tabTitle="Home" [root]="setTab1" tabIcon="home"></ion-tab>
<ion-tab tabTitle="Search" [root]="setTab2" tabIcon="search"></ion-tab>
<ion-tab tabTitle="Lessons" [root]="setTab3" tabIcon="book"></ion-tab>
<ion-tab tabTitle="Notifications" [root]="setTab4" tabIcon="star"></ion-tab>
<ion-tab tabTitle="Account" [root]="setTab5" tabIcon="person"></ion-tab>
</ion-tabs>
试试这个,我希望对你有帮助 创造
import { Component, ViewChild } from '@angular/core';
export class ClassName {
/*ADD this inside your class */
@ViewChild("paymentTabs") paymentTabs: Tabs;
加在这里
/* add paymentTabs with # ion-tabs*/
<ion-tabs #paymentTabs [selectedIndex]="{{changTab}}">
我希望它能对您有所帮助。您是否为选项卡创建了@ViewChild?请告诉我如何创建
/* add paymentTabs with # ion-tabs*/
<ion-tabs #paymentTabs [selectedIndex]="{{changTab}}">
/* Select tab via index*/
this.paymentTabs.select(1);