zhaomeizi
 checkPhone() {
      var mobile = \'\';
      var tel = /^0\d{2,3}-?\d{7,8}$/;
      var phone = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/; 
      if(mobile.length == 11){//手机号码
        if(phone.test(mobile)) {
          console.log(mobile);
          return true;
        }
      }else if(mobile.length == 12 && mobile.indexOf("-") != -1 ){//电话号码
        if(tel.test(mobile)) {
          console.log(mobile);
          return true;
        }
      }
        console.log(\'请输入有效的号码!\'); 
    }

 

分类:

技术点:

相关文章:

  • 2022-01-10
  • 2021-12-24
  • 2021-12-20
  • 2021-12-23
  • 2022-12-23
  • 2021-12-05
猜你喜欢
  • 2022-02-17
  • 2021-12-31
  • 2022-02-06
  • 2021-12-15
  • 2022-12-23
相关资源
相似解决方案