index.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. import Vue from 'vue'
  2. import VueRouter from 'vue-router'
  3. Vue.use(VueRouter)
  4. const routes = [
  5. {
  6. path: '/',
  7. name: 'Layout',
  8. component: () => import('../views/layout/index.vue'),
  9. redirect: { name: 'Home' },
  10. children: [
  11. {
  12. path: '/Layout/Home',
  13. name: 'Home',
  14. component: () => import('../views/Home/index.vue'),
  15. meta: { myName: 'Home' },
  16. },
  17. // Visit页面
  18. {
  19. path: '/Layout/Visit',
  20. name: 'Visit',
  21. component: () => import('../views/Visit/index.vue'),
  22. meta: { myName: 'Visit' },
  23. redirect: { name: 'Visit1' },
  24. children: [
  25. {
  26. path: '/Layout/Visit/1',
  27. name: 'Visit1',
  28. component: () => import('../views/Visit/Visit1.vue'),
  29. meta: { myName: 'Visit', nameAll: 'Hours, Direction & Admission' },
  30. },
  31. {
  32. path: '/Layout/Visit/2',
  33. name: 'Visit2',
  34. component: () => import('../views/Visit/Visit2.vue'),
  35. meta: { myName: 'Visit', nameAll: 'Reservation' },
  36. },
  37. {
  38. path: '/Layout/Visit/3',
  39. name: 'Visit3',
  40. component: () => import('../views/Visit/Visit3.vue'),
  41. meta: { myName: 'Visit', nameAll: 'Floor Plans' },
  42. },
  43. {
  44. path: '/Layout/Visit/4',
  45. name: 'Visit4',
  46. component: () => import('../views/Visit/Visit4.vue'),
  47. meta: { myName: 'Visit', nameAll: 'Audio Guide & Tour' },
  48. },
  49. {
  50. path: '/Layout/Visit/5',
  51. name: 'Visit5',
  52. component: () => import('../views/Visit/Visit5.vue'),
  53. meta: { myName: 'Visit', nameAll: 'Accessibility' },
  54. },
  55. {
  56. path: '/Layout/Visit/6',
  57. name: 'Visit6',
  58. component: () => import('../views/Visit/Visit6.vue'),
  59. meta: { myName: 'Visit', nameAll: 'Café & Shop' },
  60. },
  61. {
  62. path: '/Layout/Visit/7',
  63. name: 'Visit7',
  64. component: () => import('../views/Visit/Visit7.vue'),
  65. meta: { myName: 'Visit', nameAll: 'Visitor Guidelines' },
  66. },
  67. ]
  68. },
  69. // 列表Exhibitions页面
  70. {
  71. path: '/Layout/Exhibitions/:id',
  72. name: 'Exhibitions',
  73. component: () => import('../views/Exhibitions/index.vue'),
  74. meta: { myName: 'Exhibitions' },
  75. },
  76. // 列表Exhibitions详情页面
  77. {
  78. path: '/Layout/ExhibitionsInfo',
  79. name: 'ExhibitionsInfo',
  80. component: () => import('../views/Exhibitions/info.vue'),
  81. meta: { myName: 'Exhibitions' },
  82. },
  83. // Collections页面
  84. {
  85. path: '/Layout/Collections',
  86. name: 'Collections',
  87. component: () => import('../views/Collections/index.vue'),
  88. meta: { myName: 'Collections' },
  89. },
  90. ]
  91. }
  92. ]
  93. const router = new VueRouter({
  94. // mode: 'history',
  95. base: process.env.BASE_URL,
  96. routes
  97. })
  98. // 导航守卫,回到页面顶部
  99. router.beforeEach((to, from, next) => {
  100. document.documentElement.scrollTop = 0
  101. next()
  102. })
  103. export default router