fix: 上面时间同步

This commit is contained in:
MKStoler 2024-09-24 18:14:01 +08:00
parent 94b35132e2
commit cb712db29e

View File

@ -1,13 +1,7 @@
<template>
<v-system-bar class="position-fixed">
<v-icon icon="mdi-window-close" @click="ipcHandleExit"></v-icon>
<span class="ms-2">{{
new Date().toLocaleTimeString('en-US', {
hour: 'numeric',
minute: 'numeric',
hour12: false
})
}}</span>
<span class="ms-2">{{ currentTime }}</span>
</v-system-bar>
<v-app-bar :elevation="2" class="position-fixed">
<v-app-bar-title>{{ profileStore.appHeader }}</v-app-bar-title>
@ -21,12 +15,32 @@
</template>
<script setup>
import { ref, onMounted, onUnmounted } from 'vue';
import { useRouter } from 'vue-router';
import { useProfileStore } from '../stores/app';
const profileStore = useProfileStore();
const router = useRouter();
const currentTime = ref(
new Date().toLocaleTimeString('en-US', {
hour: 'numeric',
minute: 'numeric',
hour12: false
})
);
const updateTime = () => {
currentTime.value = new Date().toLocaleTimeString('en-US', {
hour: 'numeric',
minute: 'numeric',
hour12: false
});
};
onMounted(() => {
const interval = setInterval(updateTime, 1000);
onUnmounted(() => clearInterval(interval));
});
const ipcHandleExit = () => window.electron.ipcRenderer.send('prog:exit');
const router = useRouter();
</script>