zoukankan      html  css  js  c++  java
  • 倒计时

    // 倒计时
        countdown() {
          var reg = /^d{2}$/
          var ending = new Date(this.days)
          var now = new Date()
          if (now >= ending) {
            clearTimeout(this.timeout)
            return
          }
          var disc = ending - now
          this.hour = parseInt(disc / 1000 / 60 / 60 % 24)
          this.hour = !reg.test(this.hour) ? '0' + this.hour : this.hour
          this.minutes = parseInt(disc / 1000 / 60 % 60)
          this.minutes = !reg.test(this.minutes) ? '0' + this.minutes : this.minutes
          this.seconds = parseInt(disc / 1000 % 60)
          this.seconds = !reg.test(this.seconds) ? '0' + this.seconds : this.seconds
          this.timeout = setTimeout(this.countdown, 1000)
          return this.minutes
        },
        // 当前时间往后固定时间
        getTime(day) {
          var today = new Date()
          var endMouth = today.getMonth() + 1
          if (endMouth < 10) {
            endMouth = '0' + endMouth
          }
          var beforMilliseconds = today.getTime() + 1000 * 3600 * 24 * day
          var beforday = new Date()
          beforday.setTime(beforMilliseconds)
          var strYear = beforday.getFullYear()
          var strDay = beforday.getDate()
          var strMonth = beforday.getMonth() + 1
          let hour = beforday.getHours()
          let minute = beforday.getMinutes()
          let second = beforday.getSeconds()
          if (strMonth < 10) {
            strMonth = '0' + strMonth
          }
          return strYear + '/' + strMonth + '/' + strDay + ' ' + hour + ':' + minute + ':' + second
        },
    created() {
        this.days = this.getTime(0.03125)
      },
  • 相关阅读:
    OpenACC 数据管理语句
    OpenACC 简单的直方图
    OpenACC 书上的范例代码(Jacobi 迭代),part 2
    OpenACC 书上的范例代码(Jacobi 迭代),part 1
    OpenACC parallel
    OpenCL 归约 1
    OpenCL 双调排序 GPU 版
    OpenCL 双调排序 CPU 版
    OpenCL 图像卷积 3 使用 CPU
    中括号记法
  • 原文地址:https://www.cnblogs.com/taochengyong/p/14337990.html
Copyright © 2011-2022 走看看