fixing sub path

This commit is contained in:
Warunee Tamkoo 2024-12-08 12:21:42 +07:00
parent 4317f7f7d1
commit d9fca2f4a8
5 changed files with 103 additions and 105 deletions

View file

@ -2,7 +2,7 @@ import type { RouteRecordRaw } from "vue-router";
// import { ref } from "vue";
// import { useRoute } from "vue-router";
const Error404NotFound = () => import("@/views/Error404NotFound.vue");
const data = await fetch("/manual/toc.json").then((r) => r.json());
const data = await fetch("/toc.json").then((r) => r.json());
// const routes = useRoute();
// const hasQueryParam = ref<boolean>(false);
@ -41,14 +41,12 @@ const manualRoute = mergeManual.map(
const route: RouteRecordRaw[] = [
{
path: "/manual/:name",
path: "/:name",
name: "Manual",
component: () => import("@/modules/01_manual/MainPage.vue"),
beforeEnter: (to, from, next) => {
const mergeAll = [...mainDataInfo, ...manualRoute];
const itemExists = mergeAll.some(
(item) => item.path === window.location.pathname
);
const itemExists = mergeAll.some((item) => item.name === "Manual");
if (itemExists) {
next();