router.ts 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. import { createRouter, createWebHistory } from 'vue-router'
  2. // @ts-ignore
  3. import NProgress from 'nprogress'
  4. const router = createRouter({
  5. history: createWebHistory(import.meta.env.BASE_URL),
  6. scrollBehavior() {
  7. return { top: 0, left: 0 }
  8. },
  9. routes: [
  10. {
  11. path: '/login',
  12. component: () => import('./pages/login/index.vue'),
  13. },
  14. {
  15. path: '/register',
  16. component: () => import('./pages/register/index.vue'),
  17. },
  18. {
  19. path: '/password/:action',
  20. component: () => import('./pages/password/index.vue'),
  21. props: true,
  22. },
  23. {
  24. path: '/imei/:action',
  25. component: () => import('./pages/imei/index.vue'),
  26. props: true,
  27. },
  28. {
  29. path: '/fill-order',
  30. component: () => import('./pages/fill-order/index.vue'),
  31. },
  32. {
  33. path: '/pay-result/:status',
  34. component: () => import('./pages/pay-result/index.vue'),
  35. props: true,
  36. },
  37. {
  38. path: '/account',
  39. component: () => import('./pages/account/index.vue'),
  40. },
  41. {
  42. path: '/order',
  43. component: () => import('./pages/my-order/index.vue'),
  44. },
  45. {
  46. path: '/gift-card',
  47. component: () => import('./pages/gift-card/index.vue'),
  48. },
  49. {
  50. path: '/order/:id',
  51. component: () => import('./pages/benefits/index.vue'),
  52. },
  53. {
  54. path: '/mailing',
  55. component: () => import('./pages/mailing/index.vue'),
  56. },
  57. {
  58. path: '/renewal',
  59. component: () => import('./pages/renewal/index.vue'),
  60. props: true,
  61. },
  62. {
  63. path: '/appointment',
  64. component: () => import('./pages/appointment/index.vue'),
  65. props: true,
  66. },
  67. {
  68. path: '/appointment-list',
  69. component: () => import('./pages/appointment/records.vue'),
  70. },
  71. {
  72. path: '/invite',
  73. component: () => import('./pages/invite/index.vue'),
  74. },
  75. ],
  76. })
  77. router.beforeEach(() => {
  78. NProgress.start()
  79. })
  80. router.afterEach(() => NProgress.done())
  81. router.onError(() => NProgress.remove())
  82. export default router