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:
@@ -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,5 +1,5 @@
|
||||
<template>
|
||||
<div v-if="active" class="wizard-tab-container">
|
||||
<div v-show="active" class="wizard-tab-container">
|
||||
<slot>
|
||||
</slot>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user