frontend/src/views/main/screenMonitor/topHeader.vue

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<template>
  <div id="top-header">
    <dv-decoration-8 class="header-left-decoration" />
    <dv-decoration-5 class="header-center-decoration" />
    <dv-decoration-8 class="header-right-decoration" :reverse="true" />
    <div class="center-title">智慧养老服务数据中心</div>
    <div class="title-time">{{ dateFormat(date) }}</div>
  </div>
</template>

<script>
  export default {
    name: 'TopHeader',
    data() {
      return {
        date: new Date()
      }
    },
    methods: {
      dateFormat(time) {
        var date = new Date(time)
        return date.toLocaleString('zh-Hans-CN', {
          // timeZone:['UTC'],
          weekday: 'long',
          hours12: false,
          year: 'numeric',
          month: '2-digit',
          day: '2-digit',
          hour: '2-digit',
          minute: '2-digit',
          second: '2-digit'
        })

        // var year = date.getFullYear();
        // /* 在日期格式中,月份是从0开始的,因此要加0
        //  * 使用三元表达式在小于10的前面加0,以达到格式统一  如 09:11:05
        //  * */
        // var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
        // var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
        // var hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
        // var minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
        // var seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
        // var show_day = new Array('星期一', '星期二', '星期三', '星期四', '星期五', '星期六', '星期日');
        // // 拼接
        // return year + "年" + month + "月" + day + "日 " + hours + ":" + minutes + ":" + seconds;
      }
    },
    mounted() {
      const _this = this
      this.timer = setInterval(() => {
        _this.date = new Date()
      }, 1000)
    },
    beforeDestroy() {
      if (this.timer) {
        clearInterval(this.timer)
      }
    }
  }
</script>
后面还有 43 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。