diff --git a/src/components/article/template/ArticlePublic.vue b/src/components/article/template/ArticlePublic.vue index 59a72ab..d4838b0 100644 --- a/src/components/article/template/ArticlePublic.vue +++ b/src/components/article/template/ArticlePublic.vue @@ -32,6 +32,7 @@ const articleTime = computed(() => { return "编辑于 " + Time.toPassedDateTime(article.value.updatedAt); } } + return ""; }); diff --git a/src/router/index.ts b/src/router/index.ts index 2a1c911..c277011 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -25,11 +25,6 @@ export default createRouter({ path: "/about", name: "About", component: ArticleDetail - }, - { - // 兼容性保留 - path: "/article/aid:id.html", - redirect: to => `/aid${to.params.id}.html` } ] } diff --git a/src/types/Article.ts b/src/types/Article.ts index c9fbc05..f602b5d 100644 --- a/src/types/Article.ts +++ b/src/types/Article.ts @@ -4,7 +4,6 @@ import { AttachmentView, Model } from "timi-web"; export type Article = { title?: string; type: ArticleType; - classId: number; digest?: string; data?: string; extendData?: E; @@ -24,9 +23,6 @@ export type ArticleView
-
+
>(); -const isAbout = ref(false); const template = ref(null); const templates: Record = { ABOUT: ArticleAbout, @@ -58,17 +57,17 @@ const templates: Record = { PUBLIC: ArticlePublic, SOFTWARE: ArticleSoftware }; +const isAboutRoute = computed(() => route.name === "About"); watch(article, () => { if (article.value) { - template.value = markRaw(templates[article.value.type]); + const key = isAboutRoute.value ? "ABOUT" : article.value.type; + template.value = markRaw(templates[key]); } }); onMounted(async () => { - isAbout.value = route.name === "About"; - - const id = isAbout.value ? 1 : route.params.id as any as number; + const id = isAboutRoute.value ? 1 : route.params.id as any as number; article.value = await ArticleAPI.view(id); });