Skip to content

Commit

Permalink
Fixed #416 - TabMenu error when no route matches one of the menu paths
Browse files Browse the repository at this point in the history
  • Loading branch information
cagataycivici committed Aug 4, 2020
1 parent b1bfa2f commit 5c847c0
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/components/tabmenu/TabMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down

1 comment on commit 5c847c0

@AntonLindell
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have issues with this code. This is my error:

Uncaught (in promise) TypeError: Cannot read properties of null (reading 'style')
at Proxy.updateInkBar (primevue_tablist.js?v=e843fc1a:147:16)
at Proxy. (primevue_tablist.js?v=e843fc1a:89:13)

on:
inkbar.style.width = getOuterWidth(activeTab) + "px";

Please sign in to comment.