2
0
mirror of https://github.com/tenrok/vue-form-wizard.git synced 2026-06-08 04:52:24 +03:00

#37 Validate all steps when going more than one step

This commit is contained in:
cristijora
2017-08-28 19:27:45 +03:00
parent d52aa9bad8
commit 899b8abb1a
+7 -1
View File
@@ -219,7 +219,13 @@
let validate = index > this.activeTabIndex
if (index <= this.maxStep) {
let cb = () => {
this.changeTab(this.activeTabIndex, index)
if (validate && index - this.activeTabIndex > 1) {
// validate all steps recursively until destination index
this.changeTab(this.activeTabIndex, this.activeTabIndex + 1)
this.beforeTabChange(this.activeTabIndex, cb)
} else {
this.changeTab(this.activeTabIndex, index)
}
}
if (validate) {
this.beforeTabChange(this.activeTabIndex, cb)