From dda21654000330854ce07bb451d665babfcc96c8 Mon Sep 17 00:00:00 2001 From: cristijora Date: Mon, 4 Sep 2017 20:42:16 +0300 Subject: [PATCH] #40 Support sync modifier for start-index --- src/components/FormWizard.vue | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/FormWizard.vue b/src/components/FormWizard.vue index 19b5db7..f3789ea 100644 --- a/src/components/FormWizard.vue +++ b/src/components/FormWizard.vue @@ -203,6 +203,10 @@ } }, methods: { + emitTabChange (prevIndex, nextIndex) { + this.$emit('on-change', prevIndex, nextIndex) + this.$emit('update:startIndex', nextIndex) + }, addTab (item) { const index = this.$slots.default.indexOf(item.$vnode) this.tabs.splice(index, 0, item) @@ -224,7 +228,7 @@ if (index < this.activeTabIndex) { this.maxStep = this.activeTabIndex - 1 this.activeTabIndex = this.activeTabIndex - 1 - this.$emit('on-change', this.activeTabIndex + 1, this.activeTabIndex) + this.emitTabChange(this.activeTabIndex + 1, this.activeTabIndex) } tabs.splice(index, 1) } @@ -331,7 +335,7 @@ newTab.active = true } if (emitChangeEvent && this.activeTabIndex !== newIndex) { - this.$emit('on-change', oldIndex, newIndex) + this.emitTabChange(oldIndex, newIndex) } this.activeTabIndex = newIndex this.activateTabAndCheckStep(this.activeTabIndex)