2
2
import { computed , reactive , ref , watchEffect } from ' vue' ;
3
3
4
4
import { IcRoundLock } from ' @vben-core/iconify' ;
5
- import { $t } from ' @vben-core/locales' ;
5
+ import { $t , useI18n } from ' @vben-core/locales' ;
6
6
import {
7
7
VbenAvatar ,
8
8
VbenButton ,
@@ -27,14 +27,13 @@ const props = withDefaults(defineProps<Props>(), {
27
27
28
28
const emit = defineEmits <{ toLogin: []; unlock: [string ] }>();
29
29
30
+ const { locale } = useI18n ();
31
+
30
32
const now = useNow ();
31
- const year = useDateFormat (now , ' YYYY' );
32
- const month = useDateFormat (now , ' MM' );
33
- const day = useDateFormat (now , ' DD' );
34
- const week = useDateFormat (now , ' dddd' );
35
- const hour = useDateFormat (now , ' HH' );
36
33
const meridiem = useDateFormat (now , ' A' );
34
+ const hour = useDateFormat (now , ' HH' );
37
35
const minute = useDateFormat (now , ' mm' );
36
+ const date = useDateFormat (now , ' YYYY-MM-DD dddd' , { locales: locale .value });
38
37
39
38
const showUnlockForm = ref (false );
40
39
const validPass = ref (true );
@@ -102,9 +101,9 @@ function toggleUnlockForm() {
102
101
<div
103
102
class =" bg-accent flex-center relative mb-14 mr-20 h-4/5 w-2/5 flex-auto rounded-3xl text-center text-[260px]"
104
103
>
105
- <span class =" absolute left-4 top-4 text-xl font-semibold" >{{
106
- meridiem
107
- }} </span >
104
+ <span class =" absolute left-4 top-4 text-xl font-semibold" >
105
+ {{ meridiem }}
106
+ </span >
108
107
{{ hour }}
109
108
</div >
110
109
<div
@@ -124,7 +123,7 @@ function toggleUnlockForm() {
124
123
>
125
124
<div class =" flex-col-center mb-10 w-[300px]" >
126
125
<VbenAvatar :src =" avatar" class =" enter-x mb-6 size-20" />
127
- <div class =" items-cente enter-x mb-2 w-full" >
126
+ <div class =" enter-x mb-2 w-full items-center " >
128
127
<VbenInputPassword
129
128
v-model =" formState.password"
130
129
:autofocus =" true"
@@ -164,7 +163,7 @@ function toggleUnlockForm() {
164
163
<div v-if =" showUnlockForm" class =" enter-x mb-2 text-3xl" >
165
164
{{ hour }}:{{ minute }} <span class =" text-lg" >{{ meridiem }}</span >
166
165
</div >
167
- <div class =" text-3xl" >{{ year }}/{{ month }}/{{ day }} {{ week }}</div >
166
+ <div class =" text-3xl" >{{ date }}</div >
168
167
</div >
169
168
</div >
170
169
</template >
0 commit comments