index.js 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  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/:id',
  86. name: 'Collections',
  87. component: () => import('../views/Collections/index.vue'),
  88. meta: { myName: 'Collections' },
  89. },
  90. // LearnEngage页面
  91. {
  92. path: '/Layout/LearnEngage/:id',
  93. name: 'LearnEngage',
  94. component: () => import('../views/LearnEngage/index.vue'),
  95. meta: { myName: 'Learn & Engage' },
  96. },
  97. // LearnEngage详情页面
  98. {
  99. path: '/Layout/LearnEngageInfo',
  100. name: 'LearnEngageInfo',
  101. component: () => import('../views/LearnEngage/info.vue'),
  102. meta: { myName: 'Learn & Engage' },
  103. },
  104. // Publications页面
  105. {
  106. path: '/Layout/Publications',
  107. name: 'Publications',
  108. component: () => import('../views/Publications/index.vue'),
  109. meta: { myName: 'Publications' },
  110. redirect: { name: 'Publications1' },
  111. children: [
  112. {
  113. path: '/Layout/Publications/1',
  114. name: 'Publications1',
  115. component: () => import('../views/Publications/Publications1.vue'),
  116. meta: { myName: 'Publications', nameAll: 'Magazines' },
  117. },
  118. {
  119. path: '/Layout/PublicationsInfo',
  120. name: 'PublicationsInfo',
  121. component: () => import('../views/Publications/PublicationsInfo.vue'),
  122. meta: { myName: 'Publications', nameAll: 'Magazines' },
  123. },
  124. {
  125. path: '/Layout/Publications/2',
  126. name: 'Publications2',
  127. component: () => import('../views/Publications/Publications2.vue'),
  128. meta: { myName: 'Publications', nameAll: 'Exhibition Catalogues' },
  129. },
  130. {
  131. path: '/Layout/Publications/3',
  132. name: 'Publications3',
  133. component: () => import('../views/Publications/Publications3.vue'),
  134. meta: { myName: 'Publications', nameAll: 'Research' },
  135. },
  136. ]
  137. },
  138. // JoinSupport页面
  139. {
  140. path: '/Layout/JoinSupport',
  141. name: 'JoinSupport',
  142. component: () => import('../views/JoinSupport/index.vue'),
  143. meta: { myName: 'Join & Support' },
  144. redirect: { name: 'Volunteer' },
  145. children: [
  146. {
  147. path: '/Layout/JoinSupport/Volunteer',
  148. name: 'Volunteer',
  149. component: () => import('../views/JoinSupport/Volunteer.vue'),
  150. meta: { myName: 'Join & Support', nameAll: 'Volunteer' },
  151. },
  152. {
  153. path: '/Layout/JoinSupport/VolunteerInfo',
  154. name: 'VolunteerInfo',
  155. component: () => import('../views/JoinSupport/VolunteerInfo.vue'),
  156. meta: { myName: 'Join & Support', nameAll: 'Volunteer' },
  157. },
  158. {
  159. path: '/Layout/JoinSupport/Give',
  160. name: 'Give',
  161. component: () => import('../views/JoinSupport/Give.vue'),
  162. meta: { myName: 'Join & Support', nameAll: 'Give' },
  163. },
  164. {
  165. path: '/Layout/JoinSupport/GiveInfo',
  166. name: 'GiveInfo',
  167. component: () => import('../views/JoinSupport/GiveInfo.vue'),
  168. meta: { myName: 'Join & Support', nameAll: 'Give' },
  169. },
  170. ]
  171. },
  172. //About页面
  173. {
  174. path: '/Layout/About',
  175. name: 'About',
  176. component: () => import('../views/About/index.vue'),
  177. meta: { myName: 'About' },
  178. },
  179. {
  180. path: '/Layout/About/Director',
  181. name: 'Director',
  182. component: () => import('../views/About/Director.vue'),
  183. meta: { myName: 'About' },
  184. },
  185. {
  186. path: '/Layout/About/link',
  187. name: 'AboutLink',
  188. component: () => import('../views/About/link.vue'),
  189. meta: { myName: 'About' },
  190. },
  191. ]
  192. }
  193. ]
  194. const router = new VueRouter({
  195. // mode: 'history',
  196. base: process.env.BASE_URL,
  197. routes
  198. })
  199. // 导航守卫,回到页面顶部
  200. router.beforeEach((to, from, next) => {
  201. document.documentElement.scrollTop = 0
  202. next()
  203. })
  204. export default router