vue验证码组件如何使用(vue,web开发)

时间:2024-05-05 13:40:07 作者 : 石家庄SEO 分类 : web开发
  • TAG :

代码如下:

<template><divclass="join_formitem"><labelclass="enquiry">验证码<span>:</span></label><divclass="captcha"><inputtype="text"placeholder="请输入验证码"class="yanzhengma_input"v-model="picLyanzhengma"/><inputtype="button"@click="createdCode"class="verification"v-model="checkCode"/></div></div></template><script>exportdefault{data(){return{code:"",checkCode:"",picLyanzhengma:""//..验证码图片}},created(){this.createdCode()},methods:{//图片验证码createdCode(){//先清空验证码输入this.code=""this.checkCode=""this.picLyanzhengma=""//验证码长度constcodeLength=4//随机数constrandom=newArray(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(leti=0;i<codeLength;i++){//取得随机数的索引(0~35)letindex=Math.floor(Math.random()*36)//根据索引取得随机数加到code上this.code+=random[index]}//把code值赋给验证码this.checkCode=this.code}}}</script><style>.yanzhengma_input{font-family:"Exo2",sans-serif;border:1pxsolid#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:5px05px10px;margin-left:30px;height:30px;margin-top:25px;border:1pxsolid#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>

vue验证码组件如何使用

 </div> <div class="zixun-tj-product adv-bottom"></div> </div> </div> <div class="prve-next-news">
本文:vue验证码组件如何使用的详细内容,希望对您有所帮助,信息来源于网络。
上一篇:Docker如何停止容器下一篇:

14 人围观 / 0 条评论 ↓快速评论↓

(必须)

(必须,保密)

阿狸1 阿狸2 阿狸3 阿狸4 阿狸5 阿狸6 阿狸7 阿狸8 阿狸9 阿狸10 阿狸11 阿狸12 阿狸13 阿狸14 阿狸15 阿狸16 阿狸17 阿狸18