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

    data:     
    show: true,
    count: "",
    timer: null,
    
    getCode() {
          const TIME_COUNT = 60;
          if (!this.timer) {
            this.count = TIME_COUNT;
            this.show = false;
            this.timer = setInterval(() => {
              if (this.count > 0 && this.count <= TIME_COUNT) {
                this.count -= 1;
              } else {
                this.show = true;
                clearInterval(this.timer);
                this.timer = null;
              }
            }, 1000);
          }
    },
     

          }
     setEndTime() {
          var _this = this;
          var interval = setInterval(function timestampToTime() {
            var FinishTime = new Date(_this.zero.end_time);
            var PresentTime = Date.parse(new Date()) / 1000;
            var Time = FinishTime - PresentTime;
            console.log(Time);
            if (Time < 0) {
              clearInterval(interval);
            } else {
              _this.day = parseInt(Time / 60 / 60 / 24);
              _this.hour = parseInt((Time / 60 / 60) % 24);
              _this.minute = parseInt((Time / 60) % 60);
              _this.secondsec = parseInt(Time % 60);
              if (_this.day < 10) {
                _this.day = "0" + _this.day;
              }
              if (_this.hour < 10) {
                _this.hour = "0" + _this.hour;
              }
              if (_this.minute < 10) {
                _this.minute = "0" + _this.minute;
              }
              if (_this.secondsec < 10) {
                _this.secondsec = "0" + _this.secondsec;
              }
            }
          }, 1000);
        },
    

      

        },
  • 相关阅读:
    撤回本地的提交
    antd Table每列样式修改
    大数组拼树
    滑动加载
    数组合并去除重复内容
    获取前一周期日期
    js 对象根据value获取对应的key
    less git上传问题处理
    5G
    Linux怎么安装node.js
  • 原文地址:https://www.cnblogs.com/yugueilou/p/14303592.html
Copyright © 2011-2022 走看看