From 5c847c0292780d466b00cb4a5a106a48f68f7d2a Mon Sep 17 00:00:00 2001 From: cagataycivici Date: Tue, 4 Aug 2020 15:50:50 +0300 Subject: [PATCH] Fixed #416 - TabMenu error when no route matches one of the menu paths --- src/components/tabmenu/TabMenu.vue | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/components/tabmenu/TabMenu.vue b/src/components/tabmenu/TabMenu.vue index 7ba6f660d..2007d1a51 100755 --- a/src/components/tabmenu/TabMenu.vue +++ b/src/components/tabmenu/TabMenu.vue @@ -76,9 +76,17 @@ export default { return null; }, updateInkBar() { - let tabHeader = this.$refs.nav.children[this.findActiveTabIndex()]; - this.$refs.inkbar.style.width = DomHandler.getWidth(tabHeader) + 'px'; - this.$refs.inkbar.style.left = DomHandler.getOffset(tabHeader).left - DomHandler.getOffset(this.$refs.nav).left + 'px'; + let activeTabIndex = this.findActiveTabIndex(); + if (activeTabIndex !== null) { + let tabHeader = this.$refs.nav.children[activeTabIndex]; + this.$refs.inkbar.style.width = DomHandler.getWidth(tabHeader) + 'px'; + this.$refs.inkbar.style.left = DomHandler.getOffset(tabHeader).left - DomHandler.getOffset(this.$refs.nav).left + 'px'; + } + else { + this.$refs.inkbar.style.width = '0px'; + this.$refs.inkbar.style.left = '0px'; + } + } }, computed: {