mirror of
https://github.com/tenrok/vue-form-wizard.git
synced 2026-06-23 11:30:32 +03:00
#40 Support sync modifier for start-index
This commit is contained in:
@@ -203,6 +203,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
emitTabChange (prevIndex, nextIndex) {
|
||||||
|
this.$emit('on-change', prevIndex, nextIndex)
|
||||||
|
this.$emit('update:startIndex', nextIndex)
|
||||||
|
},
|
||||||
addTab (item) {
|
addTab (item) {
|
||||||
const index = this.$slots.default.indexOf(item.$vnode)
|
const index = this.$slots.default.indexOf(item.$vnode)
|
||||||
this.tabs.splice(index, 0, item)
|
this.tabs.splice(index, 0, item)
|
||||||
@@ -224,7 +228,7 @@
|
|||||||
if (index < this.activeTabIndex) {
|
if (index < this.activeTabIndex) {
|
||||||
this.maxStep = this.activeTabIndex - 1
|
this.maxStep = this.activeTabIndex - 1
|
||||||
this.activeTabIndex = 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)
|
tabs.splice(index, 1)
|
||||||
}
|
}
|
||||||
@@ -331,7 +335,7 @@
|
|||||||
newTab.active = true
|
newTab.active = true
|
||||||
}
|
}
|
||||||
if (emitChangeEvent && this.activeTabIndex !== newIndex) {
|
if (emitChangeEvent && this.activeTabIndex !== newIndex) {
|
||||||
this.$emit('on-change', oldIndex, newIndex)
|
this.emitTabChange(oldIndex, newIndex)
|
||||||
}
|
}
|
||||||
this.activeTabIndex = newIndex
|
this.activeTabIndex = newIndex
|
||||||
this.activateTabAndCheckStep(this.activeTabIndex)
|
this.activateTabAndCheckStep(this.activeTabIndex)
|
||||||
|
|||||||
Reference in New Issue
Block a user