router.ts 2.0 KB

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