mirror of
https://github.com/keven1024/015.git
synced 2026-06-08 05:14:33 +00:00
feat(front): integrate GlobalDayjs component for dynamic date localization and formatting
This commit is contained in:
14
front/components/GlobalDayjs.vue
Normal file
14
front/components/GlobalDayjs.vue
Normal file
@@ -0,0 +1,14 @@
|
||||
<script setup lang="ts">
|
||||
import dayjs from 'dayjs'
|
||||
import relativeTime from 'dayjs/plugin/relativeTime'
|
||||
import 'dayjs/locale/en'
|
||||
import 'dayjs/locale/zh-cn'
|
||||
|
||||
dayjs.extend(relativeTime)
|
||||
|
||||
const { locale } = useI18n()
|
||||
|
||||
watchEffect(() => {
|
||||
dayjs.locale(locale.value.toLowerCase())
|
||||
})
|
||||
</script>
|
||||
Reference in New Issue
Block a user