fixing path

This commit is contained in:
Warunee Tamkoo 2024-12-08 13:18:31 +07:00
parent 6c2ba74f08
commit eb3f8d3947
5 changed files with 19 additions and 13 deletions

View file

@ -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) {

View file

@ -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();

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("/toc.json").then((r) => r.json());
const data = await fetch("/manual/toc.json").then((r) => r.json());
// const routes = useRoute();
// const hasQueryParam = ref<boolean>(false);

View file

@ -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);

View file

@ -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 },