Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ Event Name | Params
------------ | -------------
tab-change | tabIndex, newTab, oldTab
input | tabTitle
tab-added | tabsLength

### tab-change example

Expand Down
7 changes: 4 additions & 3 deletions src/components/VueTabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export default {
addTab (item) {
const index = this.$slots.default.indexOf(item.$vnode);
this.tabs.splice(index, 0, item);
this.$emit('tab-added', this.tabs.length);
},
removeTab (item) {
const tabs = this.tabs;
Expand All @@ -104,9 +105,9 @@ export default {
findTabAndActivate (tabNameOrIndex) {
let indexToActivate = this.tabs.findIndex((tab, index) => tab.title === tabNameOrIndex || index === tabNameOrIndex)
// if somehow activeTabIndex is not reflected in the actual vue-tab instance, set it.
+ if (indexToActivate === this.activeTabIndex && !this.tabs[this.activeTabIndex].active) {
+ this.tabs[this.activeTabIndex].active = true;
+ }
if (indexToActivate === this.activeTabIndex && !this.tabs[this.activeTabIndex].active) {
this.tabs[this.activeTabIndex].active = true;
}
if (indexToActivate !== -1) {
this.changeTab(this.activeTabIndex, indexToActivate)
} else {
Expand Down