2
0
mirror of https://github.com/tenrok/vue-form-wizard.git synced 2026-06-25 04:40:33 +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) this.beforeTabChange(this.activeTabIndex, cb)
} else { } else {
this.changeTab(this.activeTabIndex, index) this.changeTab(this.activeTabIndex, index)
this.afterTabChange(this.activeTabIndex)
} }
} }
if (validate) { if (validate) {
@@ -295,6 +296,7 @@
let cb = () => { let cb = () => {
if (this.activeTabIndex < this.tabCount - 1) { if (this.activeTabIndex < this.tabCount - 1) {
this.changeTab(this.activeTabIndex, this.activeTabIndex + 1) this.changeTab(this.activeTabIndex, this.activeTabIndex + 1)
this.afterTabChange(this.activeTabIndex)
} else { } else {
this.$emit('on-complete') this.$emit('on-complete')
} }
@@ -377,6 +379,16 @@
callback() 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) { changeTab (oldIndex, newIndex, emitChangeEvent = true) {
let oldTab = this.tabs[oldIndex] let oldTab = this.tabs[oldIndex]
let newTab = this.tabs[newIndex] let newTab = this.tabs[newIndex]
+7
View File
@@ -29,6 +29,13 @@
*/ */
beforeChange: { beforeChange: {
type: Function type: Function
},
/***
* Function to execute after tab switch. Return void for now.
* Safe to assume necessary validation has already occured
*/
afterChange: {
type: Function
}, },
route: { route: {
type: [String, Object] type: [String, Object]