码迷,mamicode.com
首页 > 其他好文 > 详细

VUE 注册验证码页面实例

时间:2018-11-05 22:26:56      阅读:170      评论:0      收藏:0      [点我收藏+]

标签:BMI   val   back   html   mount   input   UNC   set   efault   

代码如下  无css

<template>
  <div>
    <header>
      <router-link to="/inon"><i class="el-icon-back" ></i></router-link>
      <p>手机号码验证</p>
    </header>
    <main>
      <p>为了安全,我们会向手机发送验证码</p>
      <div>
        <input type="text" maxlength="1" tabindex="0" ref="a1" v-on:input="$refs.a2.focus()">
        <input type="text" maxlength="1" ref="a2" v-on:input="$refs.a3.focus()">
        <input type="text" maxlength="1" ref="a3" v-on:input="$refs.a4.focus()">
        <input type="text" maxlength="1" ref="a4" v-on:input="submit()">
      </div>
    </main>
  </div>

</template>

 

export default {
  name:‘trans‘,
  data:function(){
    return{
      time:5,
      show:false,
      CountDown:true,
    }
  },
  methods:{
    submit(){
      alert("注册成功");
    },
    Time(){
      let t =setInterval(()=>{
        this.time--;
        if(this.time==0){
          clearInterval(t);
          this.show=true;
          this.CountDown=false;
          this.tttime=5;
        }
      },1000)
    },
    TTTime(){
      this.time=5
      this.show=false;
      this.CountDown=true;
      let t=setInterval(()=>{
        this.time--;
        if(this.time==0){
          clearInterval(t);
          this.show=true;
          this.CountDown=false;
        }
      },1000)
    }
  },
  mounted() {
    this.$refs.a1.focus();
    this.Time();
  },
}

  

VUE 注册验证码页面实例

标签:BMI   val   back   html   mount   input   UNC   set   efault   

原文地址:https://www.cnblogs.com/banyuege/p/9911889.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!