mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-09 16:16:41 +08:00
@ -166,12 +166,10 @@ Using tabs with Angular's router is fairly straight forward. Here you only need
|
||||
|
||||
## Events
|
||||
|
||||
| Event | Description | Type |
|
||||
| ------------------ | -------------------------------------------------------------------------- | --------------------------------------- |
|
||||
| `ionChange` | Emitted when the tab changes. | `CustomEvent<{tab: HTMLIonTabElement}>` |
|
||||
| `ionNavDidChange` | Emitted when the navigation has finished transitioning to a new component. | `CustomEvent<void>` |
|
||||
| `ionNavWillChange` | Emitted when the navigation is about to transition to a new component. | `CustomEvent<void>` |
|
||||
| `ionNavWillLoad` | Emitted when the navigation will load a component. | `CustomEvent<void>` |
|
||||
| Event | Description | Type |
|
||||
| ------------------- | -------------------------------------------------------------------------- | ---------------------------- |
|
||||
| `ionTabsDidChange` | Emitted when the navigation has finished transitioning to a new component. | `CustomEvent<{tab: string}>` |
|
||||
| `ionTabsWillChange` | Emitted when the navigation is about to transition to a new component. | `CustomEvent<{tab: string}>` |
|
||||
|
||||
|
||||
## Methods
|
||||
|
||||
@ -23,25 +23,21 @@ export class Tabs implements NavOutlet {
|
||||
/** @internal */
|
||||
@Prop({ mutable: true }) useRouter = false;
|
||||
|
||||
/**
|
||||
* Emitted when the tab changes.
|
||||
*/
|
||||
@Event() ionChange!: EventEmitter<{tab: HTMLIonTabElement}>;
|
||||
|
||||
/**
|
||||
* Emitted when the navigation will load a component.
|
||||
* @internal
|
||||
*/
|
||||
@Event() ionNavWillLoad!: EventEmitter<void>;
|
||||
|
||||
/**
|
||||
* Emitted when the navigation is about to transition to a new component.
|
||||
*/
|
||||
@Event() ionNavWillChange!: EventEmitter<void>;
|
||||
@Event({ bubbles: false }) ionTabsWillChange!: EventEmitter<{tab: string}>;
|
||||
|
||||
/**
|
||||
* Emitted when the navigation has finished transitioning to a new component.
|
||||
*/
|
||||
@Event() ionNavDidChange!: EventEmitter<void>;
|
||||
@Event({ bubbles: false }) ionTabsDidChange!: EventEmitter<{tab: string}>;
|
||||
|
||||
async componentWillLoad() {
|
||||
if (!this.useRouter) {
|
||||
@ -162,7 +158,7 @@ export class Tabs implements NavOutlet {
|
||||
this.transitioning = true;
|
||||
this.leavingTab = this.selectedTab;
|
||||
this.selectedTab = selectedTab;
|
||||
this.ionNavWillChange.emit();
|
||||
this.ionTabsWillChange.emit({ tab: selectedTab.tab });
|
||||
return selectedTab.setActive();
|
||||
}
|
||||
|
||||
@ -180,8 +176,7 @@ export class Tabs implements NavOutlet {
|
||||
if (leavingTab) {
|
||||
leavingTab.active = false;
|
||||
}
|
||||
this.ionChange.emit({ tab: selectedTab });
|
||||
this.ionNavDidChange.emit();
|
||||
this.ionTabsDidChange.emit({ tab: selectedTab.tab });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user