forked from drone/command-center-dashboard

罗广辉
2025-03-28 d348e995a47c66d8a95096851ea8d3898e58e3b9
src/views/Home/components/HomeLeft/HomeLeft.vue
@@ -2,7 +2,7 @@
  <div class="home-left">
    <!--时间 天气-->
    <div class="time-weather">
      <div class="time">2025.03.04 15:30:00</div>
      <div class="time">{{ time }}</div>
      <div class="line"></div>
      <div class="weather">
        <img src="@/assets/images/tq.png" alt="" />
@@ -20,6 +20,23 @@
<script setup>
import OverviewNext from './OverviewNext.vue';
import InspectionRaskDetails from './InspectionRaskDetails.vue';
import dayjs from 'dayjs';
const time = ref('');
const updateTime = () => {
    time.value = dayjs().format('YYYY.MM.DD HH:mm:ss');
};
onMounted(() => {
    updateTime(); // 立即执行一次
    time.value = setInterval(updateTime, 1000);
});
onUnmounted(() => {
    if (time.value) {
        clearInterval(time.value);
        time.value = null;
    }
});
</script>
<style scoped lang="scss">