add router

This commit is contained in:
jiaming 2018-12-13 18:48:20 +08:00
parent ecbdbe0446
commit 0aa790635a
1 changed files with 79 additions and 0 deletions

79
src/router/index.js Normal file
View File

@ -0,0 +1,79 @@
import Vue from 'vue'
import Router from 'vue-router'
const Demo = r => require.ensure([], () => r(require('../views/demo/index.vue')), 'demo')
const Document = r => require.ensure([], () => r(require('../views/demo/document.vue')), 'demo')
const BorderBox = r => require.ensure([], () => r(require('../views/demo/borderBox.vue')), 'demo')
const Decoration = r => require.ensure([], () => r(require('../views/demo/decoration.vue')), 'demo')
const Chart = r => require.ensure([], () => r(require('../views/demo/chart.vue')), 'demo')
const Table = r => require.ensure([], () => r(require('../views/demo/table.vue')), 'datav')
const Datav = r => require.ensure([], () => r(require('../views/datavEntrance/index.vue')), 'datav')
const View = r => require.ensure([], () => r(require('../views/dataView/index.vue')), 'datav')
Vue.use(Router)
export default new Router({
routes: [
{
path: '/demo',
name: 'demo',
component: Demo,
children: [
{
path: 'document',
name: 'document',
component: Document
},
{
path: 'borderBox',
name: 'borderBox',
component: BorderBox
},
{
path: 'decoration',
name: 'decoration',
component: Decoration
},
{
path: 'chart',
name: 'chart',
component: Chart
},
{
path: 'table',
name: 'table',
component: Table
}
]
},
{
path: '/datav',
name: 'datav',
component: Datav,
redirect: '/datav/view',
children: [
{
path: 'view',
name: 'view',
component: View
},
{
path: '*',
redirect: '/datav/view'
}
]
},
{
path: '*',
redirect: { name: 'demo' }
}
]
})