Blame view

src/views/binding/binDing.vue 1.16 KB
94c1e6a3   liuqimichale   微信公众号 个人页面集合
1
2
3
4
5
6
7
8
9
10
  <template>
    <div>
  
      <mt-field label="手机号" placeholder="请输入正确的手机号" type="tel" v-model="phone" :attr="{ maxlength: 13 }"></mt-field>
  
      <mt-field label="验证码" v-model="codeText">
        <div class="getCode" @click="getCode">{{timeNum}}</div>
      </mt-field>
  
      <div style="margin-top: 34px" class="leftRightPadding">
5e52ed7c   刘淇   个人中心
11
        <van-button type="info" block>绑定</van-button>
94c1e6a3   liuqimichale   微信公众号 个人页面集合
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
      </div>
    </div>
  </template>
  
  <script>
  export default {
    name: 'binDing',
    data() {
      return {
        codeText: '',
        phone: '',
        timeText: '获取验证码',
        timeNum: 60,
      }
    },
    created(){
      this.timeNum = this.timeText
    },
    methods: {
      getCode: function () {
        var _this = this
        // this.timeText = this.timeNum+'S'
        let Num = 5
        var timer = setInterval(function () {
          _this.timeNum = Num-- +'s'
          if(Num== -1){
            _this.timeNum = '获取验证码'
            clearInterval(timer)
          }
        }, 1000)
      }
    }
  }
  </script>
  
  <style scoped lang="scss">
    .getCode {
      width: 100px;
      height: 48px;
      line-height: 48px;
      background: #ef4f4f;
      color: #fff;
      text-align: center;
    }
  </style>