index.ts 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import Vue from "vue";
  2. import Router from "vue-router";
  3. import { PAGE_PATH } from "../config";
  4. Vue.use(Router);
  5. const router = new Router({
  6. mode: "hash",
  7. scrollBehavior: () => ({ x: 0, y: 0 }),
  8. routes: [
  9. { path: "/", redirect: PAGE_PATH.equipmentRecord },
  10. {
  11. path: PAGE_PATH.layout,
  12. redirect: PAGE_PATH.equipmentRecord,
  13. component: () => import("../views/Layout/index.vue"),
  14. children: [
  15. {
  16. path: PAGE_PATH.equipmentRecord,
  17. component: () => import("../views/equipmentRecord/index.vue"),
  18. },
  19. ],
  20. },
  21. // {
  22. // path: PAGE_PATH.layout,
  23. // component: () => import("../views/Layout/index.vue"),
  24. // redirect: PAGE_PATH.user,
  25. // children: [
  26. // {
  27. // path: PAGE_PATH.user,
  28. // // component: () => import("../views/User/index.vue"),
  29. // },
  30. // {
  31. // path: PAGE_PATH.authority,
  32. // // component: () => import("../views/Authority/index.vue"),
  33. // }
  34. // ],
  35. // },
  36. ],
  37. });
  38. // router.beforeEach((to, from, next) => {
  39. // NProgress.start()
  40. // if(to.fullPath !== '/login' && !auth()){
  41. // router.replace({ path: '/login'})
  42. // return next()
  43. // }
  44. // next()
  45. // })
  46. // router.beforeEach((to, from, next) => {
  47. // NProgress.start();
  48. // if (to.fullPath !== "/login" && !auth()) {
  49. // next("/login");
  50. // } else {
  51. // next();
  52. // }
  53. // });
  54. // router.afterEach(() => {
  55. // NProgress.done();
  56. // });
  57. export default router;