fix(vue): ion-tab-bar no longer throws undefined error when re-creating tabs (#22261)

resolves #22255
This commit is contained in:
Liam DeBeasi
2020-10-07 09:37:25 -04:00
committed by GitHub
parent 2bad1bb82e
commit d746561ea2
4 changed files with 33 additions and 11 deletions

View File

@ -9,10 +9,10 @@ export const IonTabBar = defineComponent({
// TODO types
const tabs = Array.from(this.$el.querySelectorAll('ion-tab-button')) as any[];
const activeTab = tabs.find(tab => currentRoute.pathname.startsWith(tab.href));
const tabBar = this.$refs.ionTabBar;
if (activeTab) {
if (activeTab && tabBar) {
ionRouter.handleSetCurrentTab(activeTab.tab);
const tabBar = this.$refs.ionTabBar;
tabBar.selectedTab = activeTab.tab;
}
}