<template> <label for=""> </label> <input type="text" placeholder=" Class ="btn1" @click="getCode"> </button> <button V-show ="! </button> </template> <script> export default {data(){show" class="btn2" disabled="disabled">{{auth_time}} Return {phone: ",// phone number auth_time: }}, methods:{getCode () {this.$http.post(' API /takeout/index.php? w=login&t=send_code', { phone:this.phone, }).then((res) => { let data = res.data; if( data.status == 0 ){ this.$toast(data.msg); } else if( data.status == 1 ){ this.$toast(data.msg); This. show = false; // Display countdown button // execute every second auth_time--, when the value of auth_time <=0, display get verification code button, clear timer, 60s var auth_timetimer = setInterval(()=>{this.auth_time--; if(this.auth_time<=0){ this.show = true; clearInterval(auth_timetimer); this.auth_time = 60; }}, 1000); }}); }, }, </script>Copy the code