2
0
mirror of https://github.com/tenrok/vue-form-wizard.git synced 2026-06-16 14:40:32 +03:00

Fix start-index issue

This commit is contained in:
cristijora
2017-07-13 00:17:22 +03:00
parent 388be24f4a
commit 062a69a03d
3 changed files with 11 additions and 18 deletions
+10 -6
View File
@@ -224,6 +224,7 @@
this.tabs.splice(index, 0, item)
// if a step is added before the current one, go to it
if (index < this.activeTabIndex + 1) {
console.log('Changing tabs', index, this.activeTabIndex)
this.maxStep = index
this.changeTab(this.activeTabIndex + 1, index)
}
@@ -237,6 +238,10 @@
this.maxStep = this.activeTabIndex - 1
this.changeTab(this.activeTabIndex, this.activeTabIndex - 1)
}
if (index < this.activeTabIndex) {
this.maxStep = this.activeTabIndex - 1
this.activeTabIndex = this.activeTabIndex - 1
}
tabs.splice(index, 1)
}
},
@@ -385,14 +390,13 @@
this.navigateToTab(matchingTabIndex, shouldValidate)
}
},
getTabs () {
let tabs = this.$slots.default.filter((comp) => comp.componentOptions && comp.componentOptions.tag === 'tab-content')
.map(comp => {
return comp.componentInstance
})
return tabs
deactivateTabs () {
this.tabs.forEach(tab => {
tab.active = false
})
},
activateTab (index) {
this.deactivateTabs()
let tab = this.tabs[index]
tab.active = true
this.tryChangeRoute(tab)