Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastiandedeyne committed Oct 6, 2017
1 parent c1e9ac5 commit 49947f9
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/components/Tabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
role="presentation"
v-show="tab.isVisible"
>

<a v-html="tab.header"
:aria-controls="tab.hash"
:aria-selected="tab.isActive"
Expand All @@ -16,7 +15,6 @@
class="tabs-component-tab-a"
role="tab"
></a>

</li>
</ul>
<div class="tabs-component-panels">
Expand All @@ -34,9 +32,9 @@
options: {
type: Object,
required: false,
default () {
default: () => ({
useUrlFragment: true
},
}),
},
},
Expand Down Expand Up @@ -81,7 +79,7 @@
},
selectTab(selectedTabHash, event) {
// see if we should store the hash in the url fragment
// See if we should store the hash in the url fragment.
if (event && !this.options.useUrlFragment) {
event.preventDefault();
}
Expand All @@ -102,6 +100,7 @@
expiringStorage.set(this.storageKey, selectedTab.hash, this.cacheLifetime);
},
setTabVisible(hash, visible) {
const tab = this.findTab(hash);
Expand All @@ -110,16 +109,20 @@
}
tab.isVisible = visible;
if (tab.isActive) {
// if tab is active, set a different one as active
// If tab is active, set a different one as active.
tab.isActive = visible;
this.tabs.every(function(element, index, array) {
if (element.isVisible) {
element.isActive = true;
this.tabs.every((tab, index, array) => {
if (tab.isVisible) {
tab.isActive = true;
return false;
}
return true;
})
});
}
},
},
Expand Down

0 comments on commit 49947f9

Please sign in to comment.