Skip to content

Commit 93f851c

Browse files
author
Pooya Parsa
committed
[tabs] only use active tag for initial update (bootstrap-vue#220)
1 parent a2f1cc8 commit 93f851c

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

lib/components/tabs.vue

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
:href="tab.href"
88
@click.prevent.stop="setTab(index)"
99
v-if="!tab.headHtml"
10-
>{{ tab.title }}</a>
10+
>{{ tab.title }}</a>
1111
<div :class="['tab-head',{small: small, active: tab.localActive, disabled: tab.disabled}]"
1212
v-else
1313
v-html="tab.headHtml"></div>
@@ -28,7 +28,7 @@
2828
export default {
2929
data() {
3030
return {
31-
currentTab: this.value || 0,
31+
currentTab: this.value,
3232
tabs: []
3333
};
3434
},
@@ -160,11 +160,13 @@
160160
// Set initial active tab
161161
let tabIndex = this.currentTab;
162162
163-
this.tabs.forEach((tab, index) => {
164-
if (tab.active) {
165-
tabIndex = index;
166-
}
167-
});
163+
if (this.currentTab === null || this.currentTab === undefined) {
164+
this.tabs.forEach((tab, index) => {
165+
if (tab.active) {
166+
tabIndex = index;
167+
}
168+
});
169+
}
168170
169171
this.setTab(tabIndex, true);
170172
},
@@ -182,7 +184,7 @@
182184
this.updateTabs();
183185
184186
// Observe Child changes so we can notify tabs change
185-
observeDom(this.$el, this.updateTabs.bind(this));
187+
observeDom(this.$el, this.updateTabs.bind(this), {subtree: true});
186188
}
187189
};
188190

0 commit comments

Comments
 (0)