You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
378 B
22 lines
378 B
/** |
|
* 手机号验证 |
|
* @param {*} str |
|
*/ |
|
|
|
// 工具 正则验证 |
|
export function validatePhone(str) { |
|
|
|
const reg = /^1[3456789]\d{9}$/; |
|
return reg.test(str); |
|
} |
|
|
|
|
|
/** |
|
* 正数验证(最多保留两位小数) |
|
* @param {*} str |
|
*/ |
|
export function validateFloat(str) { |
|
|
|
const reg = /^(([1-9][0-9]*)|(([0]\.\d{1,5}|[1-9][0-9]*\.\d{1,5})))$/; |
|
return reg.test(str); |
|
}
|
|
|