這篇文章主要講解了vue實現(xiàn)倒計時獲取驗證碼效果的方法,內(nèi)容清晰明了,對此有興趣的小伙伴可以學習一下,相信大家閱讀完之后會有幫助。
創(chuàng)新互聯(lián)建站主要從事做網(wǎng)站、成都網(wǎng)站設(shè)計、網(wǎng)頁設(shè)計、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務(wù)。立足成都服務(wù)東乃,十年網(wǎng)站建設(shè)經(jīng)驗,價格優(yōu)惠、服務(wù)專業(yè),歡迎來電咨詢建站服務(wù):18982081108
效果:
代碼:
<template> <div> <el-button :disabled="disabled" @click="sendcode" class="sendcode">{{btntxt}}</el-button> </div> </template> <script> export default { data() { return { disabled:false, time:5, btntxt:"發(fā)送驗證碼", }; }, methods: { sendcode(){ this.time=5; this.timer(); }, //發(fā)送手機驗證碼倒計時 timer() { if (this.time > 0) { this.disabled=true; this.time--; this.btntxt=this.time+"秒"; setTimeout(this.timer, 1000); } else{ this.time=0; this.btntxt="發(fā)送驗證碼"; this.disabled=false; } }, } } </script> <style scoped> .el-button{ margin: 100px 50px; } </style>
看完上述內(nèi)容,是不是對vue實現(xiàn)倒計時獲取驗證碼效果的方法有進一步的了解,如果還想學習更多內(nèi)容,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。
本文題目:vue實現(xiàn)倒計時獲取驗證碼效果的方法
網(wǎng)址分享:http://muchs.cn/article36/jiospg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站設(shè)計公司、網(wǎng)站內(nèi)鏈、營銷型網(wǎng)站建設(shè)、網(wǎng)站收錄、軟件開發(fā)、網(wǎng)站維護
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)