Commit 807bea85 authored by 杨梦雅's avatar 杨梦雅

数字范围验证

parent 7a8ecf50
...@@ -28,7 +28,7 @@ export const isNumber = val => { ...@@ -28,7 +28,7 @@ export const isNumber = val => {
* @returns { boolean } * @returns { boolean }
*/ */
export const validateRangeNumber = (number, [min, max] = [], fixed = 0) => { export const validateRangeNumber = (number, [min, max] = [], fixed = 0) => {
let pattern = new RegExp(`^[0-9]+(\\.[0-9]{1,${fixed}})?$`); let pattern = /`^[0-9]+(\\.[0-9]{1,${fixed}})?$`/;
// 判断空字符 // 判断空字符
if (typeof number === 'string' && !number.trim()) return false if (typeof number === 'string' && !number.trim()) return false
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment