From dc35b8c1e94fd9f016afc8fd94c2b478e4787660 Mon Sep 17 00:00:00 2001 From: Fine Date: Sun, 21 Aug 2022 13:25:47 +0800 Subject: [PATCH] fix reload --- src/layout/components/NavBar.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/layout/components/NavBar.vue b/src/layout/components/NavBar.vue index d2f8541c..d1fa2610 100644 --- a/src/layout/components/NavBar.vue +++ b/src/layout/components/NavBar.vue @@ -55,6 +55,7 @@ import { useI18n } from "vue-i18n"; import timeFormat from "@/utils/timeFormat"; import { useAppStoreWithOut } from "@/store/modules/app"; import { ElMessage } from "element-plus"; +import getLocalTime from "@/utils/localtime"; const { t } = useI18n(); const appStore = useAppStoreWithOut(); @@ -70,7 +71,10 @@ const time = computed(() => [appStore.duration.start, appStore.duration.end]); const handleReload = () => { const gap = appStore.duration.end.getTime() - appStore.duration.start.getTime(); - const dates: Date[] = [new Date(new Date().getTime() - gap), new Date()]; + const dates: Date[] = [ + getLocalTime(appStore.utc, new Date(new Date().getTime() - gap)), + getLocalTime(appStore.utc, new Date()), + ]; appStore.setDuration(timeFormat(dates)); }; function changeTimeRange(val: Date[] | any) {