mirror of
https://github.com/tenrok/vue-form-wizard.git
synced 2026-06-23 20:50:34 +03:00
Fix start-index issue
This commit is contained in:
@@ -16,17 +16,6 @@
|
|||||||
<tab-content v-for="tab in tabs" :title="tab" :key="tab" icon="ti-settings">
|
<tab-content v-for="tab in tabs" :title="tab" :key="tab" icon="ti-settings">
|
||||||
{{tab}}
|
{{tab}}
|
||||||
</tab-content>
|
</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 class="loader" v-if="loadingWizard"></div>
|
||||||
<div v-if="error">
|
<div v-if="error">
|
||||||
{{error}}
|
{{error}}
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -224,6 +224,7 @@
|
|||||||
this.tabs.splice(index, 0, item)
|
this.tabs.splice(index, 0, item)
|
||||||
// if a step is added before the current one, go to it
|
// if a step is added before the current one, go to it
|
||||||
if (index < this.activeTabIndex + 1) {
|
if (index < this.activeTabIndex + 1) {
|
||||||
|
console.log('Changing tabs', index, this.activeTabIndex)
|
||||||
this.maxStep = index
|
this.maxStep = index
|
||||||
this.changeTab(this.activeTabIndex + 1, index)
|
this.changeTab(this.activeTabIndex + 1, index)
|
||||||
}
|
}
|
||||||
@@ -237,6 +238,10 @@
|
|||||||
this.maxStep = this.activeTabIndex - 1
|
this.maxStep = this.activeTabIndex - 1
|
||||||
this.changeTab(this.activeTabIndex, 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)
|
tabs.splice(index, 1)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -385,14 +390,13 @@
|
|||||||
this.navigateToTab(matchingTabIndex, shouldValidate)
|
this.navigateToTab(matchingTabIndex, shouldValidate)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getTabs () {
|
deactivateTabs () {
|
||||||
let tabs = this.$slots.default.filter((comp) => comp.componentOptions && comp.componentOptions.tag === 'tab-content')
|
this.tabs.forEach(tab => {
|
||||||
.map(comp => {
|
tab.active = false
|
||||||
return comp.componentInstance
|
})
|
||||||
})
|
|
||||||
return tabs
|
|
||||||
},
|
},
|
||||||
activateTab (index) {
|
activateTab (index) {
|
||||||
|
this.deactivateTabs()
|
||||||
let tab = this.tabs[index]
|
let tab = this.tabs[index]
|
||||||
tab.active = true
|
tab.active = true
|
||||||
this.tryChangeRoute(tab)
|
this.tryChangeRoute(tab)
|
||||||
|
|||||||
Reference in New Issue
Block a user