Compare commits
5 Commits
af7c50ecf4
...
fa26862418
Author | SHA1 | Date | |
---|---|---|---|
fa26862418 | |||
44e3349311 | |||
192c80537f | |||
fff9f214f2 | |||
74559651d7 |
@@ -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"]
|
@@ -58,7 +58,7 @@
|
||||
color="primary"
|
||||
type="single"
|
||||
variant="pill"
|
||||
trailingIcon="lucide:chevron-right"
|
||||
trailing-icon="lucide:chevron-right"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -47,8 +47,4 @@ function getSlotContent(item: TabsItem) {
|
||||
if (!item.slot) return null
|
||||
return slotContents.value[item.slot]
|
||||
}
|
||||
|
||||
defineSlots<{
|
||||
default: () => any
|
||||
}>()
|
||||
</script>
|
||||
|
@@ -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>
|
||||
|
@@ -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
|
||||
})
|
||||
}
|
||||
|
@@ -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: {
|
||||
|
Reference in New Issue
Block a user