Skip to content

Commit

Permalink
fix: 修复时间的跳变
Browse files Browse the repository at this point in the history
  • Loading branch information
camera-2018 committed Jan 27, 2023
1 parent 2a57c13 commit 9ca9b49
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion frontend/components/Aside/Sign.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<script setup lang="ts">
const day_parts = ref(useDayParts())
let day_parts = ref('')
if (process.server)
day_parts = useDayParts()
</script>

<template>
Expand Down
2 changes: 1 addition & 1 deletion frontend/composables/useTime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function useTime(num: number) {

export function useDayParts() {
const state = ref('')
const hours = useDateFormat(useNow(), 'HH', { locales: 'zh-Hans-CN' })
const hours = useDateFormat(useNow(), 'HH', { locales: 'zh-CN' })
const hour = parseInt(hours.value)
if (hour >= 0 && hour <= 11)
state.value = '早上好!'
Expand Down

0 comments on commit 9ca9b49

Please sign in to comment.