手机号正则表达

时间:2021-05-24 06:29:22   收藏:0   阅读:0
 
    async postphoneBinding(User, phone) {
      let temp = await http.phoneBinding(User, phone);
      let tel = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(
        this.phone
      );
      if (temp == null && tel) {
        // console.log(‘验证码已发送‘)
        alert("验证码已发送");
      } else if (this.phone == "") {
        alert("请输入手机号");
        return false;
      } else if (!tel) {
        alert("手机号不正确");
      }
      console.log(temp);
    },
评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!