初心-杨瑞超个人博客诚邀您加入qq群(IT-程序猿-技术交流群): 757345416丨(IT-程序猿-技术交流2群): 936929828
直接贴代码了:
telBlur: function (e) { const { tel } = this.data; const telReg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(16[0-9]{1})|(17[0-9]{1}))+d{8})$/; if (!tel) { wx.showToast({ title: '手机号不能为空', icon: 'none', duration: 2000 }) } else if (!telReg.test(tel)) { wx.showToast({ title: '请输入正确的手机号', icon: 'none', duration: 2000 }) } },emailBlur: function (e) { const { email } = this.data; const emailReg = /^[A-Za-zd]+([-_.][A-Za-zd]+)*@([A-Za-zd]+[-.])+[A-Za-zd]{2,4}$/; if (!email) { wx.showToast({ title: '邮箱不能为空', icon: 'none', duration: 2000 }) } else if (!emailReg.test(email)) { wx.showToast({ title: '请输入正确的邮箱', icon: 'none', duration: 2000 }) } },













