


Below I will share with you an example of mobile phone number, email regular verification and sending verification code in 60 seconds in Vue. It has a good reference value and I hope it will be helpful to everyone.
Today I wrote a simple verification. I originally used the component before, but I feel that the component I wrote is not very useful in this project. Since it is used in relatively few places, I wrote it directly on the page.
<p> <p class="fl"> <input name="phone" type="number" placeholder="手机号" v-model="phone"/> <button type="button" :disabled="disabled" @click="sendcode" class="btns">{{btntxt}}</button> </p> <p class="fl" style="margin-left: 20px;"> <input type="text" placeholder="验证码"/> </p> </p> <input type="button" value="查询" class="btns search" @click="query"/>
Here is the content in the script
export default { data: function () { return { disabled:false, time:0, btntxt:"获取验证码", formMess:{ email:this.email, phone:this.phone } } }, mounted: function () { }, methods:{ //验证手机号码部分 sendcode(){ var reg=11 && /^((13|14|15|17|18)[0-9]{1}\d{8})$/; //var url="/nptOfficialWebsite/apply/sendSms?mobile="+this.ruleForm.phone; if(this.phone==''){ alert("请输入手机号码"); }else if(!reg.test(this.phone)){ alert("手机格式不正确"); }else{ this.time=60; this.disabled=true; this.timer(); /*axios.post(url).then( res=>{ this.phonedata=res.data; })*/ } }, timer() { if (this.time > 0) { this.time--; this.btntxt=this.time+"s后重新获取"; setTimeout(this.timer, 1000); } else{ this.time=0; this.btntxt="获取验证码"; this.disabled=false; } }, query(){ var formMess=this.formMess Axios.post(api+"/order/select/reception", formMess) .then(function (res) { if(res.data.code==200){ console.log(res.data.data); this.productResult=res.data.data; this.productResult.length=3; }else if(res.data.code==400){ alert(res.data.message) } }.bind(this)) }, //邮箱验证 sendEmail(){ var regEmail= /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/; if(this.email==''){ alert("请输入邮箱"); }else if(!regEmail.test(this.email)){ alert("邮箱格式不正确"); } } } }
The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.
Related articles:
How to use EL expressions to obtain context parameter values in JS
JS moves the left list to the right List function
Use of el expression in js and non-empty judgment method
The above is the detailed content of Examples of mobile phone number, email regular verification and verification code sent in 60 seconds in Vue. For more information, please follow other related articles on the PHP Chinese website!

随着社交媒体的迅速发展,小红书已经成为了备受青睐的社交平台之一。用户可以通过创建小红书号来展示个人身份,并与其他用户交流互动。如果你需要查找某个用户的小红书号码,可以按照以下简单步骤进行操作。一、如何用小红书号查找用户?1.打开小红书APP,点击右下角的“发现”按钮,然后选择“笔记”选项。2.在笔记列表中,找到你想查找的用户发布的那篇笔记。点击进入笔记详情页。3.在笔记详情页中,点击用户头像下方的“关注”按钮,即可进入该用户的个人主页。4.在用户个人主页右上角,点击三个点按钮,然后选择“个人信息

微信不允许通过手机号添加怎么设置?在微信APP中是可以不允许通过手机号添加微信,但是多数的用户不知道如何设置不允许微信通过手机号,接下来就是小编为用户带来的微信不允许通过手机号添加设置方法教程,感兴趣的用户快来一起看看吧!微信使用教程微信不允许通过手机号添加怎么设置1、首先打开微信APP,进入到主页面点击右下角【我】进入,选择【设置】功能;2、之后进入到设置功能页,找到【朋友权限】服务功能;3、然后在朋友权限界面,滑动【加我为朋友时需要验证】后方的按钮;4、最后在下图所示的页面,滑动【手机号】后

手机号前面的+86是指中国的国际区号,在国内拨打国内手机,加上“+86”和不加是一样的;而国际电话区号,即国际电信联盟根据“E.164”标准分配给各国的代码;所有的号码都是前缀号,也就是说这些号码是用来“拨到”目的国家。

在数字化时代,小红书已成为许多人分享生活、发现好物的平台。随着时间的推移,我们可能需要更改账号的手机号码。那么,如何更改小红书的手机号呢?一、小红书账号怎么改手机号?1.登录小红书账号,进入“我的”页面。2.点击右上角的“...”,选择“设置”。3.在设置页面,找到“账号与安全”选项,点击进入。4.在账号与安全页面,找到“手机号码”选项,点击进入。5.此时,页面会显示当前手机号码,点击“更换手机号码”。6.输入新的手机号码,接收验证码,并填写。7.设置新的密码,确保账号安全。8.完成上述步骤后,

B站(哔哩哔哩)作为中国年轻人非常喜欢的视频分享网站,吸引了大量的用户。有些用户希望拥有两个B站账号,以便于分开管理和使用。那么,一个手机号怎么注册两个B站号呢?本文将围绕这一问题以及如何解除手机绑定展开讲解。一、一个手机号怎么注册两个B站号?1.注册新账号:首先,在手机上打开B站App或登录官网,点击“注册”按钮,选择注册方式,可以使用手机号码、邮箱或第三方账号(如微信、QQ等)进行注册。2.注册账号时,请根据系统提示填写必要的信息,包括手机号码、验证码以及设置密码等。务必确保两个账号使用不同

Golang是一门高性能、现代化的编程语言,在日常开发中经常涉及到字符串的处理。其中,验证输入是否为大写字母是一个常见的需求。本文将介绍在Golang中如何验证输入是否为大写字母。方法一:使用unicode包Golang中的unicode包提供了一系列函数来判断字符的编码类型。对于大写字母,其对应的编码范围为65-90(十进制),因此我们可以使用unicod

在golang中,验证输入是否为全角字符需要用到Unicode编码和rune类型。Unicode编码是一种将字符集中的每个字符分配一个唯一的数字码位的字符编码标准,其中包含了全角字符和半角字符。而rune类型是golang中用于表示Unicode字符的类型。第一步,需要将输入转换为rune类型的切片。这可以通过使用golang的[]rune类型进行转换,例如

近年来铁路12306的各项认证都已经修改规则,更加规范,之前可能通过他人手机号或者老旧手机号进行买票时,现在在买票则会提示无法认证的操作,影响用户们的出行,那么12306中究竟该如何更换手机号呢,这篇教程攻略就将为大家带来详细的攻略介绍,希望能帮助到各位有需要的小伙伴们。那么首选在自己已经登录上12306app的状态下,我们点击修改手机号功能然后进入到修改页面在点击绑定新手机号,用新手机号发送短信即可然后进入到短信编辑页面,按照提示发送编辑内容将收到的验证码填写进入12306app内即可完成修改


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

Dreamweaver Mac version
Visual web development tools

Notepad++7.3.1
Easy-to-use and free code editor

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft
