From bd9775f1b5b8f68f1677a63b7fd6e27593114d02 Mon Sep 17 00:00:00 2001 From: Plumbiu <99574369+Plumbiu@users.noreply.github.com> Date: Thu, 16 Feb 2023 16:03:30 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=83=AD=E5=BA=A6=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E6=A1=86=E6=87=92=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/components/ArticlesList/Navigation/index.vue | 2 +- frontend/components/ArticlesList/index.vue | 2 +- frontend/components/Main/index.vue | 2 +- frontend/composables/Articlelist/useArtlistFn.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/components/ArticlesList/Navigation/index.vue b/frontend/components/ArticlesList/Navigation/index.vue index 86f5a3f3..12530769 100644 --- a/frontend/components/ArticlesList/Navigation/index.vue +++ b/frontend/components/ArticlesList/Navigation/index.vue @@ -1,7 +1,7 @@ diff --git a/frontend/components/ArticlesList/index.vue b/frontend/components/ArticlesList/index.vue index 9b989b13..b1d75b43 100644 --- a/frontend/components/ArticlesList/index.vue +++ b/frontend/components/ArticlesList/index.vue @@ -15,7 +15,7 @@ watch(route, async () => { artlist.value = await useFetchPostData(route?.params, route.query?.sort, pagenum = 1) isLoading.value = false }, { deep: true, immediate: true }) -onBeforeMount(() => { +onMounted(() => { (window as any).addEventListener('scroll', addArtListItem) }) onUnmounted(() => { diff --git a/frontend/components/Main/index.vue b/frontend/components/Main/index.vue index 9c1e2004..ec1ae8fa 100644 --- a/frontend/components/Main/index.vue +++ b/frontend/components/Main/index.vue @@ -8,7 +8,7 @@ const route = useRoute()
- +
diff --git a/frontend/composables/Articlelist/useArtlistFn.ts b/frontend/composables/Articlelist/useArtlistFn.ts index d401c04a..f911c3d5 100644 --- a/frontend/composables/Articlelist/useArtlistFn.ts +++ b/frontend/composables/Articlelist/useArtlistFn.ts @@ -4,7 +4,7 @@ export const formatTime = (createdAt: string): string => { const now = new Date() const duration = (now.getTime() - created.getTime()) / 1000 / 60 let ans = '刚刚' - if (duration < 60) // 一小时内 + if (duration > 0 && duration < 60) // 一小时内 ans = `${(duration).toFixed(0)}分钟前` else if (duration < 60 * 24) // 一天内 ans = `${(duration / 60).toFixed(0)}小时前`