mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-22 13:32:54 +08:00
fix(tabs): select returns boolean
This commit is contained in:
@ -1365,13 +1365,13 @@ export function updateTab(nav: Nav, component: any, data: any, escapeHatch: Esca
|
|||||||
// yeah yeah, I know this is kind of ugly but oh well, I know the internal structure of <ion-tabs>
|
// yeah yeah, I know this is kind of ugly but oh well, I know the internal structure of <ion-tabs>
|
||||||
const tabs = tab.parentElement.parentElement as HTMLIonTabsElement;
|
const tabs = tab.parentElement.parentElement as HTMLIonTabsElement;
|
||||||
|
|
||||||
return isTabSelected(tabs, tab).then((isSelected: boolean) => {
|
return isTabSelected(tabs, tab).then((isSelected) => {
|
||||||
if (!isSelected) {
|
if (!isSelected) {
|
||||||
const promise = updateNav(nav, component, data, escapeHatch, isTopLevel);
|
const promise = updateNav(nav, component, data, escapeHatch, isTopLevel);
|
||||||
const app = document.querySelector('ion-app');
|
const app = document.querySelector('ion-app');
|
||||||
return app.componentOnReady().then(() => {
|
return app.componentOnReady().then(() => {
|
||||||
app.setExternalNavPromise(promise);
|
app.setExternalNavPromise(promise);
|
||||||
}).then(() => {
|
|
||||||
// okay, the tab is not selected, so we need to do a "switch" transition
|
// okay, the tab is not selected, so we need to do a "switch" transition
|
||||||
// basically, we should update the nav, and then swap the tabs
|
// basically, we should update the nav, and then swap the tabs
|
||||||
return promise.then((navResult) => {
|
return promise.then((navResult) => {
|
||||||
|
@ -122,11 +122,12 @@ export class Tabs implements NavOutlet {
|
|||||||
|
|
||||||
const leavingTab = this.selectedTab;
|
const leavingTab = this.selectedTab;
|
||||||
|
|
||||||
return selectedTab.setActive()
|
return selectedTab.setActive().then(() => {
|
||||||
.then(() => {
|
|
||||||
selectedTab.selected = true;
|
selectedTab.selected = true;
|
||||||
if (leavingTab && leavingTab !== selectedTab) {
|
if (leavingTab !== selectedTab) {
|
||||||
|
if (leavingTab) {
|
||||||
leavingTab.active = false;
|
leavingTab.active = false;
|
||||||
|
}
|
||||||
this.selectedTab = selectedTab;
|
this.selectedTab = selectedTab;
|
||||||
this.ionChange.emit(selectedTab);
|
this.ionChange.emit(selectedTab);
|
||||||
this.ionNavChanged.emit({isPop: false});
|
this.ionNavChanged.emit({isPop: false});
|
||||||
|
Reference in New Issue
Block a user