Compare commits

...

5 Commits

Author SHA1 Message Date
fa26862418 slug增加调试
Some checks failed
CI / lint (push) Failing after 9m4s
CI / typecheck (push) Failing after 15s
CI / build (ubuntu-latest) (push) Failing after 15s
2025-07-30 20:11:39 +08:00
44e3349311 lintfix 2025-07-30 19:49:50 +08:00
192c80537f 手动解码中文路径 2025-07-30 18:53:57 +08:00
fff9f214f2 修改docker 2025-07-30 18:48:57 +08:00
74559651d7 lint fix 2025-07-30 18:45:57 +08:00
6 changed files with 40 additions and 14 deletions

View File

@@ -9,4 +9,4 @@ COPY .output ./.output
ENV PORT=3000
ENV HOST=0.0.0.0
CMD ["node", "/app/server/index.mjs"]
CMD ["node", ".output/server/index.mjs"]

View File

@@ -58,7 +58,7 @@
color="primary"
type="single"
variant="pill"
trailingIcon="lucide:chevron-right"
trailing-icon="lucide:chevron-right"
/>
</div>
</div>

View File

@@ -47,8 +47,4 @@ function getSlotContent(item: TabsItem) {
if (!item.slot) return null
return slotContents.value[item.slot]
}
defineSlots<{
default: () => any
}>()
</script>

View File

@@ -10,7 +10,10 @@
v-for="(slot, i) in $slots.default?.() ?? []"
:key="i"
>
<component :is="slot" :in-stack="true" />
<component
:is="slot"
:in-stack="true"
/>
</div>
</ECard>
</template>

View File

@@ -18,9 +18,36 @@ const pageFontSizeClass = computed(() => {
return `text-${selectedFontSize.value}`
})
// 根据路由参数构建内容路径
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
})
// URL 解码并验证路径
const queryPath = computed(() => {
try {
return decodeURIComponent(path.value)
} catch (error) {
console.error('URL decode error:', error)
return path.value // 如果解码失败,返回原始路径
}
})
const { data: page } = await useAsyncData(
`page-${route.path}`, // 使用更具体的 key
() => queryCollection('docs').path(decodeURI(route.path)).first(),
() => queryCollection('docs').path(queryPath.value).first(),
{
default: () => null // 提供默认值
}
@@ -30,7 +57,7 @@ if (!page.value) {
throw createError({
statusCode: 404,
statusMessage: '文档不存在',
message: '当前页面不存在,请您检查路径是否正确',
message: `当前页面不存在,请您检查路径是否正确: ${queryPath.value}`,
fatal: true
})
}

View File

@@ -14,11 +14,6 @@ export default defineNuxtConfig({
devtools: {
enabled: true
},
fonts: {
defaults: {
weights: ['300 800'],
}
},
css: ['~/assets/css/main.css'],
content: {
@@ -61,6 +56,11 @@ export default defineNuxtConfig({
}
}
},
fonts: {
defaults: {
weights: ['300 800']
}
},
icon: {
clientBundle: {