mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 03:00:58 +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);
|
const active = this.stackCtrl.getLastUrl(stackId);
|
||||||
return active ? active.url : undefined;
|
return active ? active.url : undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getActiveStackId() {
|
||||||
|
return this.stackCtrl.getActiveStackId();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function emitEvent(el: HTMLElement, view: RouteView) {
|
function emitEvent(el: HTMLElement, view: RouteView) {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { Component, ContentChild, HostListener, ViewChild } from '@angular/core';
|
import { Component, ContentChild, HostListener, ViewChild } from '@angular/core';
|
||||||
import { TabButtonClickDetail } from '@ionic/core';
|
|
||||||
|
|
||||||
import { NavController } from '../../providers';
|
import { NavController } from '../../providers';
|
||||||
import { IonTabBar } from '../proxies';
|
import { IonTabBar } from '../proxies';
|
||||||
@ -57,14 +56,14 @@ export class IonTabs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@HostListener('ionTabButtonClick', ['$event.detail'])
|
@HostListener('ionTabButtonClick', ['$event.detail.tab'])
|
||||||
onTabButtonClick(detail: TabButtonClickDetail) {
|
select(tab: string) {
|
||||||
const { tab, selected } = detail;
|
const selected = this.outlet.getActiveStackId() === tab;
|
||||||
const href = `${this.outlet.tabsPrefix}/${tab}`;
|
const href = `${this.outlet.tabsPrefix}/${tab}`;
|
||||||
const url = selected
|
const url = selected
|
||||||
? href
|
? href
|
||||||
: this.outlet.getLastUrl(tab) || 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;
|
return views.length > 0 ? views[views.length - 1] : undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
private getActiveStackId(): string | undefined {
|
getActiveStackId(): string | undefined {
|
||||||
return this.activeView ? this.activeView.stackId : undefined;
|
return this.activeView ? this.activeView.stackId : undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user