将计量单位比例的校验改为3位小数

This commit is contained in:
季圣华
2023-03-09 22:13:32 +08:00
parent 4784882112
commit e0bf75d6a6
2 changed files with 17 additions and 7 deletions

View File

@@ -38,3 +38,13 @@ export function isDecimalTwo (s) {
let reg = /^(([^0][0-9]+|0)\.([0-9]{1,2})$)|^([^0][0-9]+|0)$/
return reg.test(s)
}
/**
* 三位小数
* @param {*} s
*/
export function isDecimalThree (s) {
let reg = /^(([^0][0-9]+|0)\.([0-9]{1,3})$)|^([^0][0-9]+|0)$/
return reg.test(s)
}