2
0
mirror of https://github.com/tenrok/vue-form-wizard.git synced 2026-06-19 22:20:32 +03:00

added afterTabChange functionality

This commit is contained in:
JVB
2018-01-12 10:31:07 -08:00
parent 4113999718
commit 606138a55b
3 changed files with 11204 additions and 0 deletions
+11185
View File
File diff suppressed because it is too large Load Diff
+12
View File
@@ -280,6 +280,7 @@
this.beforeTabChange(this.activeTabIndex, cb)
} else {
this.changeTab(this.activeTabIndex, index)
this.afterTabChange(this.activeTabIndex)
}
}
if (validate) {
@@ -295,6 +296,7 @@
let cb = () => {
if (this.activeTabIndex < this.tabCount - 1) {
this.changeTab(this.activeTabIndex, this.activeTabIndex + 1)
this.afterTabChange(this.activeTabIndex)
} else {
this.$emit('on-complete')
}
@@ -377,6 +379,16 @@
callback()
}
},
afterTabChange (index) {
console.log('aftertabchange')
if (this.loading) {
return
}
let newTab = this.tabs[index]
if (newTab && newTab.afterTabChange !== undefined) {
newTab.afterTabChange()
}
},
changeTab (oldIndex, newIndex, emitChangeEvent = true) {
let oldTab = this.tabs[oldIndex]
let newTab = this.tabs[newIndex]
+7
View File
@@ -29,6 +29,13 @@
*/
beforeChange: {
type: Function
},
/***
* Function to execute after tab switch. Return void for now.
* Safe to assume necessary validation has already occured
*/
afterChange: {
type: Function
},
route: {
type: [String, Object]