mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-17 10:41:13 +08:00

committed by
Manu MA

parent
60ef98d1a7
commit
56dd8ae342
@ -197,6 +197,10 @@ export class IonRouterOutlet implements OnDestroy, OnInit {
|
||||
const active = this.stackCtrl.getLastUrl(stackId);
|
||||
return active ? active.url : undefined;
|
||||
}
|
||||
|
||||
getActiveStackId() {
|
||||
return this.stackCtrl.getActiveStackId();
|
||||
}
|
||||
}
|
||||
|
||||
function emitEvent(el: HTMLElement, view: RouteView) {
|
||||
|
@ -1,5 +1,4 @@
|
||||
import { Component, ContentChild, HostListener, ViewChild } from '@angular/core';
|
||||
import { TabButtonClickDetail } from '@ionic/core';
|
||||
|
||||
import { NavController } from '../../providers';
|
||||
import { IonTabBar } from '../proxies';
|
||||
@ -57,14 +56,14 @@ export class IonTabs {
|
||||
}
|
||||
}
|
||||
|
||||
@HostListener('ionTabButtonClick', ['$event.detail'])
|
||||
onTabButtonClick(detail: TabButtonClickDetail) {
|
||||
const { tab, selected } = detail;
|
||||
@HostListener('ionTabButtonClick', ['$event.detail.tab'])
|
||||
select(tab: string) {
|
||||
const selected = this.outlet.getActiveStackId() === tab;
|
||||
const href = `${this.outlet.tabsPrefix}/${tab}`;
|
||||
const url = selected
|
||||
? href
|
||||
: this.outlet.getLastUrl(tab) || href;
|
||||
|
||||
this.navCtrl.navigateBack(url, true);
|
||||
return this.navCtrl.navigateBack(url, true);
|
||||
}
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ export class StackController {
|
||||
return views.length > 0 ? views[views.length - 1] : undefined;
|
||||
}
|
||||
|
||||
private getActiveStackId(): string | undefined {
|
||||
getActiveStackId(): string | undefined {
|
||||
return this.activeView ? this.activeView.stackId : undefined;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user