Skip to content

Commit

Permalink
[tabs] only use active tag for initial update (#220)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pooya Parsa committed Apr 11, 2017
1 parent a2f1cc8 commit 93f851c
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions lib/components/tabs.vue
Expand Up @@ -7,7 +7,7 @@
:href="tab.href"
@click.prevent.stop="setTab(index)"
v-if="!tab.headHtml"
>{{ tab.title }}</a>
>{{ tab.title }}</a>
<div :class="['tab-head',{small: small, active: tab.localActive, disabled: tab.disabled}]"
v-else
v-html="tab.headHtml"></div>
Expand All @@ -28,7 +28,7 @@
export default {
data() {
return {
currentTab: this.value || 0,
currentTab: this.value,
tabs: []
};
},
Expand Down Expand Up @@ -160,11 +160,13 @@
// Set initial active tab
let tabIndex = this.currentTab;
this.tabs.forEach((tab, index) => {
if (tab.active) {
tabIndex = index;
}
});
if (this.currentTab === null || this.currentTab === undefined) {
this.tabs.forEach((tab, index) => {
if (tab.active) {
tabIndex = index;
}
});
}
this.setTab(tabIndex, true);
},
Expand All @@ -182,7 +184,7 @@
this.updateTabs();
// Observe Child changes so we can notify tabs change
observeDom(this.$el, this.updateTabs.bind(this));
observeDom(this.$el, this.updateTabs.bind(this), {subtree: true});
}
};
Expand Down

0 comments on commit 93f851c

Please sign in to comment.