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

    {
          var re = /^(0|86|17951)?(13[0-9]|15[0123456789]|17[678]|18[0-9]|14[57])[0-9]{8}$/;
          if (re.test(this.ruleForm.phone)) {
            // 填写正确后,开始发送信息,倒计时
            const TIME_COUNT = 60;
            // 判断时间计时是否存在,不存在则赋值60,不显示发送验证码按钮,计时器启动循环
            if (!this.timer) {
              this.count = TIME_COUNT;
              this.show = false;
              this.Tim = setTimeout(() => {
                this.show = true;
              }, 60000);
              this.timer = setInterval(() => {
                if (this.count > 0 && this.count <= TIME_COUNT) {
                  if (this.count == 60) {
                    // 点击发送验证码(自己的函数)
                    this.cms_fs();
                  }
                  this.count--;
                } else {
                  // 计时器为0的时候显示发送验证码按钮,清空计时器
                  this.show = true;
                  clearInterval(this.timer);
                  this.timer = null;
                  return false;
                }
              }, 1000);
            }
          } else {
            // 手机存在,或者手机没有正确填写
            this.show = true;
            this.$message.error("请填写正确手机号!");
          }
        }
  • 相关阅读:
    【Python】小技巧
    【Python】内置函数清单
    【Python】序列的方法
    【Python】异常处理
    【Python】函数的参数对应
    【Python】函数对象
    redhat7安装jdk1.7报错/home/renqiwei/jdk1.7/bin/java: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
    redhat更换yum源
    python3降级为python2(linux)
    centos安装apt命令
  • 原文地址:https://www.cnblogs.com/wulicute-TS/p/12911013.html
Copyright © 2011-2022 走看看