mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-10 00:27:41 +08:00
fix(tabs): initialize select in the willLoad before the select call is made (#18300)
#17957
This commit is contained in:
@ -49,14 +49,11 @@ export class Tabs implements NavOutlet {
|
|||||||
this.useRouter = !!this.doc.querySelector('ion-router') && !this.el.closest('[no-router]');
|
this.useRouter = !!this.doc.querySelector('ion-router') && !this.el.closest('[no-router]');
|
||||||
}
|
}
|
||||||
this.tabs = Array.from(this.el.querySelectorAll('ion-tab'));
|
this.tabs = Array.from(this.el.querySelectorAll('ion-tab'));
|
||||||
|
await this.initSelect();
|
||||||
this.ionNavWillLoad.emit();
|
this.ionNavWillLoad.emit();
|
||||||
this.componentWillUpdate();
|
this.componentWillUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidLoad() {
|
|
||||||
this.initSelect();
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidUnload() {
|
componentDidUnload() {
|
||||||
this.tabs.length = 0;
|
this.tabs.length = 0;
|
||||||
this.selectedTab = this.leavingTab = undefined;
|
this.selectedTab = this.leavingTab = undefined;
|
||||||
@ -156,6 +153,7 @@ export class Tabs implements NavOutlet {
|
|||||||
}
|
}
|
||||||
// wait for all tabs to be ready
|
// wait for all tabs to be ready
|
||||||
await Promise.all(this.tabs.map(tab => tab.componentOnReady()));
|
await Promise.all(this.tabs.map(tab => tab.componentOnReady()));
|
||||||
|
|
||||||
await this.select(this.tabs[0]);
|
await this.select(this.tabs[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user