diff --git a/src/utils/validate.js b/src/utils/validate.js index 83036d7..bb484d3 100644 --- a/src/utils/validate.js +++ b/src/utils/validate.js @@ -53,3 +53,19 @@ export function chineseReg(s) { export function postcode(s) { return /^[0-9]\d{5}$/.test(s) } + +/** + * 税号 + * message:15位、17位、18位、20位数字和大写英文字母 + * */ +export function taxNo(s) { + return /^[A-Z0-9]{15}$|^[A-Z0-9]{17}$|^[A-Z0-9]{18}$|^[A-Z0-9]{20}$/.test(s) +} + +/** + * 只能输入数字 + * @param s + */ +export function number(s) { + return /^[0-9]*$/.test(s) +}