diff --git a/dev-example/App.vue b/dev-example/App.vue index 49cc1a7..44daa03 100644 --- a/dev-example/App.vue +++ b/dev-example/App.vue @@ -1,79 +1,12 @@ diff --git a/dev-example/WizardRoute.vue b/dev-example/WizardRoute.vue new file mode 100644 index 0000000..39a598e --- /dev/null +++ b/dev-example/WizardRoute.vue @@ -0,0 +1,105 @@ + + + + + diff --git a/dev-example/main.js b/dev-example/main.js index 00e25c7..fb79f7d 100644 --- a/dev-example/main.js +++ b/dev-example/main.js @@ -4,16 +4,26 @@ import Vue from 'vue' import VueRouter from 'vue-router' import App from './App.vue' import FormWizard from '../src/index' -const First = { template: '
First page
' } -const Second = { template: '
Second page
' } -const Third = { template: '
Third page
' } +import WizardRoute from './WizardRoute.vue' +import TestRoute from './TestRoute.vue' + +const First = {template: '
First page
'} +const Second = {template: '
Second page
'} +const Third = {template: '
Third page
'} const router = new VueRouter({ mode: 'history', routes: [ - { path: '/first', component: First }, - { path: '/second', component: Second }, - { path: '/third', component: Third } + { + path: '/', component: WizardRoute, + children: [ + {path: '/first', component: First}, + {path: '/second', component: Second}, + {path: '/third', component: Third} + ] + }, + {path: '/test', component: TestRoute}, + ] }) Vue.use(VueRouter) @@ -25,6 +35,5 @@ Vue.config.productionTip = false new Vue({ router, el: '#app', - template: '', - components: {App} + render: h => h(App) }) diff --git a/src/components/FormWizard.vue b/src/components/FormWizard.vue index 9efb0c6..00b8282 100644 --- a/src/components/FormWizard.vue +++ b/src/components/FormWizard.vue @@ -362,9 +362,11 @@ activateTab (index) { this.deactivateTabs() let tab = this.tabs[index] - tab.active = true - tab.checked = true - this.tryChangeRoute(tab) + if (tab) { + tab.active = true + tab.checked = true + this.tryChangeRoute(tab) + } }, activateTabAndCheckStep (index) { this.activateTab(index)