2
0
mirror of https://github.com/tenrok/vue-form-wizard.git synced 2026-06-12 14:42:26 +03:00

Add vue-router to dev deps

Revert router integration due to wrong merge
This commit is contained in:
cristi
2017-04-24 22:57:57 +03:00
parent 4f29fb639d
commit 4a9655edd3
5 changed files with 34 additions and 4 deletions
+8
View File
@@ -253,8 +253,14 @@
}
this.activeTabIndex = newIndex
this.checkStep()
this.tryChangeRoute(newTab)
return true
},
tryChangeRoute (tab) {
if (this.$router && tab.route) {
this.$router.push(tab.route)
}
},
checkStep () {
if (this.activeTabIndex === this.tabCount - 1) {
this.isLastStep = true
@@ -300,12 +306,14 @@
if (this.tabs.length > 0 && this.startIndex === 0) {
let firstTab = this.tabs[this.activeTabIndex]
firstTab.active = true
this.tryChangeRoute(firstTab)
}
if (this.startIndex < this.tabs.length) {
let tabToActivate = this.tabs[this.startIndex]
this.activeTabIndex = this.startIndex
tabToActivate.active = true
this.maxStep = this.startIndex
this.tryChangeRoute(this.tabs[this.startIndex])
} else {
console.warn(`Prop startIndex set to ${this.startIndex} is greater than the number of tabs - ${this.tabs.length}. Make sure that the starting index is less than the number of tabs registered`)
}
+3
View File
@@ -26,6 +26,9 @@
*/
beforeChange: {
type: Function
},
route: {
type: [String, Object]
}
},
data () {