From acd10e9507100ddd19617d7597093f39d01c7925 Mon Sep 17 00:00:00 2001 From: Michael Tintiuc Date: Mon, 6 Jan 2020 22:25:33 +0200 Subject: [PATCH] Fixes #102 --- src/components/navigation/ion-tabs.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/navigation/ion-tabs.ts b/src/components/navigation/ion-tabs.ts index 953e04f..2909ac0 100644 --- a/src/components/navigation/ion-tabs.ts +++ b/src/components/navigation/ion-tabs.ts @@ -134,10 +134,15 @@ function parseTabBar(vnode: VNode, tab: string, listeners: EventListeners): VNod for (const child of vnode.children) { if (child.tag && child.tag === 'ion-tab-button') { const clickHandler = (e: Event) => { - const path = (child.elm as HTMLIonTabButtonElement).tab || '/'; + const path = (child.elm as HTMLIonTabButtonElement).tab; const route = hasDataAttr(child, 'to') ? child.data!.attrs!.to : { path }; e.preventDefault(); + // Do not trigger any events if there's nowhere to go to + if (!route) { + return; + } + if (Array.isArray(IonTabsWillChange)) { IonTabsWillChange.map(item => item(route)); } else if (IonTabsWillChange) {