From fb66a3837743f1d4c4c1d384bbfacbf4149088ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=86=9B?= <510423039@qq.com> Date: Mon, 7 Nov 2022 17:11:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=94=81=E5=B1=8F=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vben28/src/views/sys/lock/useNow.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/vben28/src/views/sys/lock/useNow.ts b/vben28/src/views/sys/lock/useNow.ts index 2fac748d..e42a805b 100644 --- a/vben28/src/views/sys/lock/useNow.ts +++ b/vben28/src/views/sys/lock/useNow.ts @@ -1,11 +1,8 @@ import { dateUtil } from '/@/utils/dateUtil'; import { reactive, toRefs } from 'vue'; -import { useLocaleStore } from '/@/store/modules/locale'; import { tryOnMounted, tryOnUnmounted } from '@vueuse/core'; export function useNow(immediate = true) { - const localeStore = useLocaleStore(); - const localData = dateUtil.localeData(localeStore.getLocale); let timer: IntervalHandle; const state = reactive({ @@ -28,13 +25,13 @@ export function useNow(immediate = true) { state.year = now.get('y'); state.month = now.get('M') + 1; - state.week = localData.weekdays()[now.day()]; - state.day = now.get('D'); + state.week = '星期' + ['日', '一', '二', '三', '四', '五', '六'][now.day()]; + state.day = now.get('date'); state.hour = h; state.minute = m; state.second = s; - state.meridiem = localData.meridiem(Number(h), Number(h), true); + state.meridiem = now.format('A'); }; function start() { @@ -60,4 +57,4 @@ export function useNow(immediate = true) { start, stop, }; -} +} \ No newline at end of file