export default class Validator {
    static required(val, msg) {
        if ((!val && val != 0) || val.length === 0) {
            throw msg
        }
        return this
    }

    static mobile(val) {
        if (!val || val.length !== 11 || !/^((13|14|15|17|18)[0-9]{1}\d{8})$/.test(val)) {
            throw '必须是11位手机号码'
        }
        return this
    }
}

 

相关文章:

  • 2021-06-14
  • 2021-12-26
  • 2021-10-01
  • 2022-12-23
猜你喜欢
  • 2022-01-11
  • 2021-12-12
  • 2022-12-23
  • 2022-12-23
  • 2022-02-11
  • 2021-10-20
  • 2021-12-14
相关资源
相似解决方案