router.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. import Vue from 'vue';
  2. import Router from 'vue-router';
  3. Vue.use(Router);
  4. const router = new Router({
  5. mode: 'history',
  6. base: process.env.NODE_ENV === 'development' ? '' : process.env.VUE_APP_ROUTER,
  7. routes: [
  8. {
  9. path: '/',
  10. component: () => import('@/views/index/index.vue'),
  11. },
  12. {
  13. path: '/info',
  14. component: () => import('@/views/info/index.vue'),
  15. children: [
  16. {
  17. path: 'list/:parent_id',
  18. component: () => import('@/views/info/list.vue'),
  19. },
  20. ],
  21. },
  22. {
  23. path: '/info/detail',
  24. component: () => import('@/views/info/detail.vue'),
  25. },
  26. {
  27. path: '/jobfair',
  28. component: () => import('@/views/jobfair/index.vue'),
  29. children: [
  30. {
  31. path: 'list/:type',
  32. component: () => import('@/views/jobfair/list.vue'),
  33. },
  34. ],
  35. },
  36. {
  37. path: '/jobfair/detail',
  38. component: () => import('@/views/jobfair/detail.vue'),
  39. },
  40. {
  41. path: '/talk',
  42. component: () => import('@/views/talk/index.vue'),
  43. children: [
  44. {
  45. path: 'list/:type',
  46. component: () => import('@/views/talk/list.vue'),
  47. },
  48. ],
  49. },
  50. {
  51. path: '/talk/detail',
  52. component: () => import('@/views/talk/detail.vue'),
  53. },
  54. {
  55. path: '/jobinfo',
  56. component: () => import('@/views/jobinfo/index.vue'),
  57. children: [
  58. {
  59. path: 'list',
  60. component: () => import('@/views/jobinfo/list.vue'),
  61. },
  62. ],
  63. },
  64. {
  65. path: '/jobinfo/detail',
  66. component: () => import('@/views/jobinfo/detail.vue'),
  67. },
  68. {
  69. path: '/jobs',
  70. component: () => import('@/views/jobs/index.vue'),
  71. children: [
  72. {
  73. path: 'list/:type',
  74. component: () => import('@/views/jobs/list.vue'),
  75. },
  76. ],
  77. },
  78. {
  79. path: '/jobs/detail',
  80. component: () => import('@/views/jobs/detail.vue'),
  81. },
  82. {
  83. path: '/corp/detail',
  84. component: () => import('@/views/corp/index.vue'),
  85. },
  86. ],
  87. });
  88. router.afterEach((to, from, next) => {
  89. window.scrollTo(0, 0);
  90. });
  91. export default router;