From eb3f8d3947c80ec99c30b4207f565d9d95351e90 Mon Sep 17 00:00:00 2001 From: waruneeauy Date: Sun, 8 Dec 2024 13:18:31 +0700 Subject: [PATCH] fixing path --- src/modules/01_manual/MainPage.vue | 24 +++++++++++++++--------- src/modules/02_pages/MainPage.vue | 2 +- src/modules/router.ts | 2 +- src/views/MainLayout.vue | 2 +- vite.config.ts | 2 +- 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/modules/01_manual/MainPage.vue b/src/modules/01_manual/MainPage.vue index 90cc974d..5d5ea6c2 100644 --- a/src/modules/01_manual/MainPage.vue +++ b/src/modules/01_manual/MainPage.vue @@ -94,11 +94,11 @@ onMounted(async () => { window.addEventListener("resize", onResize); if (typeof route.params.name === "string") { - const res = await fetch(`/documents/${route.params.name}.md`); + const res = await fetch(`/manual/documents/${route.params.name}.md`); if (res && res.ok) { const pattern = /chapter-(\d+)(?:-(\d+))?(?:-(\d+))?/; const match = pattern.exec(route.params.name); - console.log("🚀 ~ onMounted ~ match:", match) + console.log("🚀 ~ onMounted ~ match:", match); if (!match) return; @@ -107,13 +107,16 @@ onMounted(async () => { const mainChapter = +match[1] - 1; const mainChapter2 = +match[2] - 1; - subChapter.value = match[2] ? `".${match[2]}"`:'""'; - subChapter2.value = match[3] ? `".${match[3]}"`:'""'; + subChapter.value = match[2] ? `".${match[2]}"` : '""'; + subChapter2.value = match[3] ? `".${match[3]}"` : '""'; chapter.value = mainChapter; - console.log("🚀 ~ onMounted ~ chapter.value:", chapter.value) + console.log("🚀 ~ onMounted ~ chapter.value:", chapter.value); chapter2.value = mainChapter2; - console.log("🚀 ~ onMounted ~ chapter2.value = mainChapter2:", chapter2.value = mainChapter2) + console.log( + "🚀 ~ onMounted ~ chapter2.value = mainChapter2:", + (chapter2.value = mainChapter2) + ); parsed.value = md.parse(text.value, {}); } @@ -232,17 +235,20 @@ onUnmounted(() => { .markdown :deep(h2:before) { counter-increment: h2; - content: counter(h1) var(--sub-chapter) var(--sub-chapter2) "." counter(h2) " "; + content: counter(h1) var(--sub-chapter) var(--sub-chapter2) "." counter(h2) + " "; } .markdown :deep(h3:before) { counter-increment: h3; - content: counter(h1) var(--sub-chapter) var(--sub-chapter2) "." counter(h2) "." counter(h3) " "; + content: counter(h1) var(--sub-chapter) var(--sub-chapter2) "." counter(h2) + "." counter(h3) " "; } .markdown :deep(h4:before) { counter-increment: h4; - content: counter(h1) var(--sub-chapter) var(--sub-chapter2) "." counter(h2) "." counter(h3) "." counter(h4) " "; + content: counter(h1) var(--sub-chapter) var(--sub-chapter2) "." counter(h2) + "." counter(h3) "." counter(h4) " "; } .markdown :deep(blockquote) { diff --git a/src/modules/02_pages/MainPage.vue b/src/modules/02_pages/MainPage.vue index 8265453b..765f405a 100644 --- a/src/modules/02_pages/MainPage.vue +++ b/src/modules/02_pages/MainPage.vue @@ -64,7 +64,7 @@ onMounted(async () => { window.addEventListener("resize", onResize); // if (typeof route.params.name === "string") { - const res = await fetch(`/documents/${route.path}.md`); + const res = await fetch(`/manual/documents/${route.path}.md`); if (res && res.ok) { text.value = await res.text(); diff --git a/src/modules/router.ts b/src/modules/router.ts index 02d03d94..2fa93352 100644 --- a/src/modules/router.ts +++ b/src/modules/router.ts @@ -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("/toc.json").then((r) => r.json()); +const data = await fetch("/manual/toc.json").then((r) => r.json()); // const routes = useRoute(); // const hasQueryParam = ref(false); diff --git a/src/views/MainLayout.vue b/src/views/MainLayout.vue index 6838e740..d84e00f9 100644 --- a/src/views/MainLayout.vue +++ b/src/views/MainLayout.vue @@ -50,7 +50,7 @@ function getLocalStorageItem(key: string): string | null { onMounted(async () => { { - const data = await fetch("/toc.json").then((r) => r.json()); + const data = await fetch("/manual/toc.json").then((r) => r.json()); if (!!queryRole) { setLocalStorageItem("role", queryRole); diff --git a/vite.config.ts b/vite.config.ts index 1488b5cc..57f385a8 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -7,7 +7,7 @@ import { quasar, transformAssetUrls } from "@quasar/vite-plugin"; // https://vitejs.dev/config/ export default defineConfig({ - base: "", + base: "/manual/", plugins: [ vue({ template: { transformAssetUrls },