From 0aa790635add059bd9bc27b6593d1cef9e680759 Mon Sep 17 00:00:00 2001 From: jiaming <743192023@qq.com> Date: Thu, 13 Dec 2018 18:48:20 +0800 Subject: [PATCH] add router --- src/router/index.js | 79 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 src/router/index.js diff --git a/src/router/index.js b/src/router/index.js new file mode 100644 index 0000000..3212df2 --- /dev/null +++ b/src/router/index.js @@ -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' } + } + ] +})