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 } }