完成目录架构变更

This commit is contained in:
2025-08-06 23:14:36 +08:00
parent cca2b53694
commit 41e273ed07
34 changed files with 25 additions and 20 deletions

View File

@@ -19,21 +19,7 @@ const pageFontSizeClass = computed(() => {
})
//
const path = computed(() => {
const slug = route.params.slug
// slug
if (!slug) {
return '/' // slug
}
const pathValue = Array.isArray(slug) ? slug.join('/') : slug
// / /
const normalizedPath = `/${pathValue}`.replace(/\/+$/, '') // 使用 /+ 匹配多个连续的斜杠
return normalizedPath
})
const path = computed(() => route.path)
// URL
const queryPath = computed(() => {
@@ -47,7 +33,7 @@ const queryPath = computed(() => {
const { data: page } = await useAsyncData(
`page-${route.path}`, // 使 key
() => queryCollection('docs').path(queryPath.value).first(),
() => queryCollection('docs').path(decodeURIComponent(path.value)).first(),
{
default: () => null //
}