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

#24 Add on-change event before any tab change

This commit is contained in:
cristijora
2017-07-02 10:43:30 +03:00
parent 45306e301d
commit 66f3d542a9
6 changed files with 135 additions and 44 deletions
+3
View File
@@ -222,6 +222,7 @@
return index <= this.maxStep
},
navigateToTab (index) {
this.$emit('on-change', this.activeTabIndex, index)
let validate = index > this.activeTabIndex
if (index <= this.maxStep) {
let cb = () => {
@@ -236,6 +237,7 @@
}
},
nextTab () {
this.$emit('on-change', this.activeTabIndex, this.activeTabIndex + 1)
let cb = () => {
if (this.activeTabIndex < this.tabCount - 1) {
this.changeTab(this.activeTabIndex, this.activeTabIndex + 1)
@@ -247,6 +249,7 @@
this.beforeTabChange(this.activeTabIndex, cb)
},
prevTab () {
this.$emit('on-change', this.activeTabIndex, this.activeTabIndex - 1)
let cb = () => {
if (this.activeTabIndex > 0) {
this.setValidationError(null)
+1 -1
View File
@@ -1,5 +1,5 @@
<template>
<div v-if="active" class="wizard-tab-container">
<div v-show="active" class="wizard-tab-container">
<slot>
</slot>
</div>