fix reload

This commit is contained in:
Fine 2022-08-21 13:25:47 +08:00
parent f08ae5a484
commit dc35b8c1e9

View File

@ -55,6 +55,7 @@ import { useI18n } from "vue-i18n";
import timeFormat from "@/utils/timeFormat"; import timeFormat from "@/utils/timeFormat";
import { useAppStoreWithOut } from "@/store/modules/app"; import { useAppStoreWithOut } from "@/store/modules/app";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import getLocalTime from "@/utils/localtime";
const { t } = useI18n(); const { t } = useI18n();
const appStore = useAppStoreWithOut(); const appStore = useAppStoreWithOut();
@ -70,7 +71,10 @@ const time = computed(() => [appStore.duration.start, appStore.duration.end]);
const handleReload = () => { const handleReload = () => {
const gap = const gap =
appStore.duration.end.getTime() - appStore.duration.start.getTime(); 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)); appStore.setDuration(timeFormat(dates));
}; };
function changeTimeRange(val: Date[] | any) { function changeTimeRange(val: Date[] | any) {