2
0
mirror of https://github.com/tenrok/vue-form-wizard.git synced 2026-06-11 07:32:24 +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
-11
View File
@@ -16,17 +16,6 @@
<tab-content v-for="tab in tabs" :title="tab" :key="tab" icon="ti-settings">
{{tab}}
</tab-content>
<tab-content title="Additional Info"
:before-change="validateAsync"
icon="ti-settings">
Additional info
</tab-content>
<tab-content title="Last step"
icon="ti-check">
</tab-content>
<transition name="fade" mode="out-in">
<router-view></router-view>
</transition>
<div class="loader" v-if="loadingWizard"></div>
<div v-if="error">
{{error}}
+1 -1
View File
File diff suppressed because one or more lines are too long
+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)