This article example shares the specific implementation code used by the vue verification code component for your reference. The specific content is as follows The code is as follows: <template> <div class="join_formitem"> <label class="enquiry">Verification code<span>:</span></label> <div class="captcha"> <input type="text" placeholder="Please enter the verification code" class="yanzhengma_input" v-model="picLyanzhengma" /> <input type="button" @click="createdCode" class="verification" v-model="checkCode" /> </div> </div> </template> <script> export default { data(){ return { code:'', checkCode:'', picLyanzhengma:'' //..Verification code image} }, created(){ this.createdCode() }, methods: { // Image verification code createdCode(){ // Clear the verification code first this.code = "" this.checkCode = "" this.picLyanzhengma = "" //Verification code length const codeLength = 4 // Random numbers const random = new Array(0,1,2,3,4,5,6,7,8,9,'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z') for(let i = 0;i < codeLength;i++){ // Get the index of the random number (0~35) let index = Math.floor(Math.random() * 36) // Get the random number based on the index and add it to code this.code += random[index] } // Assign the code value to the verification code this.checkCode = this.code } } } </script> <style> .yanzhengma_input{ font-family: 'Exo 2',sans-serif; border: 1px solid #fff; color: #fff; outline: none; border-radius: 12px; letter-spacing: 1px; font-size: 17px; font-weight: normal; background-color: rgba(82,56,76,.15); padding: 5px 0 5px 10px; margin-left: 30px; height: 30px; margin-top: 25px; border: 1px solid #e6e6e6; } .verification{ border-radius: 12px; width: 100px; letter-spacing: 5px; margin-left: 50px; height: 40px; transform: translate(-15px,0); } .captcha{ height:50px; text-align: justify; } </style> The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
>>: How to install PHP7.4 and Nginx on Centos
Table of contents 1. Introduction to import_table...
1. Command Introduction The passwd command is use...
Preface Recently, our company has configured mbp,...
Some optimization rules for browser web pages Pag...
Today we discussed the issue of what the margin v...
1. Basics of Linux Firewall The Linux firewall sy...
Table of contents What is a Binary Search Tree (B...
Table of contents 1. Component Registration 2. Us...
Table of contents Common key aliases Key without ...
To understand load balancing, you must first unde...
Before further analyzing why MySQL database index...
Detailed Analysis of Iframe Usage <iframe frame...
1. To develop web responsively, the page must ada...
Zabbix deployment documentation After zabbix is ...
1. Command Introduction The contab (cron table) c...