Skip to content

Commit

Permalink
feat: 热度选择框懒加载
Browse files Browse the repository at this point in the history
  • Loading branch information
Plumbiu committed Feb 17, 2023
1 parent 54c1809 commit bd9775f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion frontend/components/ArticlesList/Navigation/index.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div class="navigator">
<ArticlesListNavigationLink />
<ArticlesListNavigationSelect />
<LazyArticlesListNavigationSelect v-if="$route.query?.sort?.indexOf('hottest')" />
</div>
</template>
Expand Down
2 changes: 1 addition & 1 deletion frontend/components/ArticlesList/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down
2 changes: 1 addition & 1 deletion frontend/components/Main/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const route = useRoute()
<Types class="left-0" />
<TypesTagNav v-if="route?.params?.type" />
<div class="timeline-container mt-0 relative 0.33rem">
<LazyArticlesList class="mr-21.667rem w-full mlg:w-700px" />
<ArticlesList class="mr-21.667rem w-full mlg:w-700px" />
<Aside class="absolute display-none top-0 right-0 mlg:display-block" />
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion frontend/composables/Articlelist/useArtlistFn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)}小时前`
Expand Down

0 comments on commit bd9775f

Please sign in to comment.