From c554001df3f74e5ee38686097f268eefdfa0db1b Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Fri, 29 Mar 2024 02:41:40 +0800 Subject: [PATCH] =?UTF-8?q?fix(theme):=20=E6=96=87=E4=BB=B6=E6=9C=AA?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=B0git=E6=97=B6=E6=9C=80=E5=90=8E?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=97=B6=E9=97=B4=E8=AE=A1=E7=AE=97=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- theme/src/client/components/Page.vue | 2 +- theme/src/client/composables/page.ts | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/theme/src/client/components/Page.vue b/theme/src/client/components/Page.vue index 4332b59d..83ad2320 100644 --- a/theme/src/client/components/Page.vue +++ b/theme/src/client/components/Page.vue @@ -193,7 +193,7 @@ onContentUpdated(() => zoom?.refresh()) @media (min-width: 1440px) { .plume-page:not(.has-sidebar) .content { - max-width: 784px; + max-width: 884px; } .plume-page:not(.has-sidebar) .container { diff --git a/theme/src/client/composables/page.ts b/theme/src/client/composables/page.ts index e1a1fbb2..249dde84 100644 --- a/theme/src/client/composables/page.ts +++ b/theme/src/client/composables/page.ts @@ -60,8 +60,8 @@ export function useLastUpdated() { const frontmatter = usePageFrontmatter() const lang = usePageLang() - const date = computed(() => new Date(page.value.git?.updatedTime ?? '')) - const isoDatetime = computed(() => date.value.toISOString()) + const date = computed(() => page.value.git?.updatedTime ? new Date(page.value.git.updatedTime) : null) + const isoDatetime = computed(() => date.value?.toISOString()) const datetime = ref('') @@ -76,13 +76,15 @@ export function useLastUpdated() { if (frontmatter.value.lastUpdated === false || theme.value.lastUpdated === false) return - datetime.value = new Intl.DateTimeFormat( - theme.value.lastUpdated?.formatOptions?.forceLocale ? lang.value : undefined, - theme.value.lastUpdated?.formatOptions ?? { - dateStyle: 'short', - timeStyle: 'short', - }, - ).format(date.value) + datetime.value = date.value + ? new Intl.DateTimeFormat( + theme.value.lastUpdated?.formatOptions?.forceLocale ? lang.value : undefined, + theme.value.lastUpdated?.formatOptions ?? { + dateStyle: 'short', + timeStyle: 'short', + }, + ).format(date.value) + : '' }) })