import { createRouter, createWebHashHistory } from "vue-router";

const router = createRouter({
  history: createWebHashHistory(),

  routes: [
    {
      path: "/",
      name: "home",
      redirect: "/banner",
      component: () => import("../index"),
      children: [
        {
          path: "/banner",
          component: () => import("../banner"),
        },
        {
          path: "/category",
          component: () => import("../category"),
        },
        {
          path: "/detail/:id",
          component: () => import("../detail"),
        },
      ],
    },
    {
      path: "/login",
      name: "login",
      component: () => import("../login"),
    },
    {
      path: "/404",
      name: "404",
      component: () => import("../../404"),
    },
    {
      path: "/:catchAll(.*)",
      redirect: "/404",
    },
  ],
});
// router.beforeEach((to, from) => {
//   return false;
// });
export default router;
