import {createRouter, createWebHistory, RouteRecordRaw} from "vue-router";

// 2. 配置路由
var routes: Array<RouteRecordRaw> = [
    {
        name: "home",
        path: "/",
        component: () => import("../page/Home.vue"),
        children: []
    },
    {
        name: "detail",
        path: "/detail",
        component: () => import("../page/DetailPage.vue"),
        children: [
            {
                name: "detail",
                path: "/detail/:path(.*)",
                component: () => import("../page/DetailPage.vue")
            }
        ]
    },
    {
        name: "info",
        path: "/info",
        component: () => import("../page/Info.vue"),
        children: [
            {
                name: "login",
                path: "/info/:path(.*)",
                component: () => import("../page/Info.vue")
            }
        ]
    }
];
// 1.返回一个 router 实列，为函数，里面有配置项（对象） history
const router = createRouter({
    history: createWebHistory(),
    routes,
});

// 3导出路由   然后去 main.ts 注册 router.ts
export default router