index.ts 944 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { createRouter, createWebHashHistory } from "vue-router";
  2. const router = createRouter({
  3. history: createWebHashHistory(),
  4. routes: [
  5. {
  6. path: "/",
  7. name: "home",
  8. redirect: "/banner",
  9. component: () => import("../index"),
  10. children: [
  11. {
  12. path: "/banner",
  13. component: () => import("../banner"),
  14. },
  15. {
  16. path: "/category",
  17. component: () => import("../category"),
  18. },
  19. {
  20. path: "/detail/:id",
  21. component: () => import("../detail"),
  22. },
  23. ],
  24. },
  25. {
  26. path: "/login",
  27. name: "login",
  28. component: () => import("../login"),
  29. },
  30. {
  31. path: "/404",
  32. name: "404",
  33. component: () => import("../../404"),
  34. },
  35. {
  36. path: "/:catchAll(.*)",
  37. redirect: "/404",
  38. },
  39. ],
  40. });
  41. // router.beforeEach((to, from) => {
  42. // return false;
  43. // });
  44. export default router;