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