Vue中使用 captcha.min.js 做驗證碼


1 verificationCode() {
2       let captcha1 = new CaptchaMini()
3       captcha1.draw(document.querySelector('#captcha1'), r => {
4         this.Verification = r
5       })
6  },

先在要用的組件中引入 

import CaptchaMini from '../../static/js/captcha.min.js'
 
然后寫一個容器放驗證碼:
<canvas class="canvas_v" width="100" height="50" id="captcha1"></canvas>
 
最后把上面的代碼在加載完dom后執行就可以了(
this.Verification寫你自己的變量
 
captcha.min.js地址:https://blog-static.cnblogs.com/files/lyt520/captcha.min.js


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM