e9d42eae创建于 22 天前历史提交
import { createRouter, createWebHashHistory } from "vue-router";

const routes = [
    {
        path: "/",
        component: () => import("./layouts/Main.vue"),
        children: [
            { path: "", component: () => import("./pages/Home.vue") },
            { path: "setting", component: () => import("./pages/Setting.vue") },
        ],
    },
    {
        path: "/",
        component: () => import("./layouts/Raw.vue"),
        children: [],
    },
];

const router = createRouter({
    history: createWebHashHistory(),
    routes,
});

// watch router change
router.beforeEach((to, from, next) => {
    window.$mapi?.statistics?.tick("visit", {
        path: to.path,
    });
    next();
});

export default router;