index.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import Vue from 'vue'
  2. import VueRouter from 'vue-router'
  3. const Index = () => import('@/pages/index');
  4. const Login = () => import('@/pages/login');
  5. const Log = () => import('@/pages/subPages/log');
  6. const Express = () => import('@/pages/subPages/express');
  7. const Order = () => import('@/pages/subPages/order');
  8. const Message = () => import('@/pages/subPages/message');
  9. const Status = () => import('@/pages/subPages/status');
  10. const View = () => import('@/pages/subPages/view');
  11. Vue.use(VueRouter)
  12. const routes = [
  13. {
  14. path: '/',
  15. name: 'Index',
  16. component: Index,
  17. redirect:'/express',
  18. children:[
  19. {
  20. path:'/log',
  21. name:'log',
  22. component:Log
  23. },
  24. {
  25. path:'/express',
  26. name:'express',
  27. component:Express
  28. },
  29. {
  30. path:'/order',
  31. name:'order',
  32. component:Order
  33. },
  34. {
  35. path:'/message',
  36. name:'message',
  37. component:Message
  38. },
  39. {
  40. path:'/status',
  41. name:'status',
  42. component:Status
  43. },
  44. {
  45. path:'/view',
  46. name:'view',
  47. component:View
  48. }
  49. ]
  50. },
  51. {
  52. path: '/login',
  53. name: 'Login',
  54. component: Login
  55. }
  56. ]
  57. const router = new VueRouter({
  58. routes
  59. })
  60. router.beforeEach((to,from,next)=>{
  61. next();
  62. });
  63. export default router