hrms-manual/src/modules/router.ts

36 lines
812 B
TypeScript
Raw Normal View History

2024-05-29 14:06:59 +07:00
import type { RouteRecordRaw } from "vue-router";
2023-09-06 14:51:44 +07:00
2024-06-28 13:58:31 +07:00
const data = await fetch("/toc.json").then((r) => r.json());
const manual = data.filter((v: any) => v.children);
const mergeManual: any[] = [];
manual.forEach((v: any) => mergeManual.push(...v.children));
const manualRoute = mergeManual.map(
(v): { path: string; name: string; component: Function } => {
return {
path: v.path,
name: "Manual",
component: () => import("@/modules/01_manual/MainPage.vue"),
};
}
);
2024-06-24 13:07:27 +07:00
const route: RouteRecordRaw[] = [
2024-06-28 13:58:31 +07:00
// ...manualRoute,
2023-09-06 14:51:44 +07:00
{
2024-05-29 14:06:59 +07:00
path: "/manual/:name",
name: "Manual",
component: () => import("@/modules/01_manual/MainPage.vue"),
},
2024-06-24 13:07:27 +07:00
{
path: "/:name",
name: "Pages",
component: () => import("@/modules/02_pages/MainPage.vue"),
},
];
export default route;