Blogger Information
Blog 12
fans 1
comment 1
visits 19144
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
微信小程序邮箱验证
黄小凡的博客
Original
1919 people have browsed it

  首先在wxml文件中加入form标签:

<form bindsubmit="formSubmit">
    <input name="email" placeholder="E-mail" /> 
    <button form-type="submit" class="send" >
    发送
    </button>
</form>

然后在js文件中加入formSubmit函数:

formSubmit:function(e){
    console.log(e.detail.value);
    var val = e.detail.value.email;
    var reg = /^[A-Za-z\d]+([-_.][A-Za-z\d]+)*@([A-Za-z\d]+[-.])+[A-Za-z\d]{2,4}$/; 
    if(reg.test(val)){
      console.log('输入正确');
    }else{
      console.log('输入不正确');
    }
  }

即可进行验证。

今天工作中遇到这样一个要求,发现百度尚无相关***,故此,写此博文,希望对大家有所帮助!

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post