From 00a145c26adaa7dd630293b0af182c775fecd443 Mon Sep 17 00:00:00 2001 From: zhang_li <2235006734@qqq.com> Date: Tue, 9 Apr 2024 11:30:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/validator.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/utils/validator.ts b/src/utils/validator.ts index cafde51c7..490cd75e7 100644 --- a/src/utils/validator.ts +++ b/src/utils/validator.ts @@ -339,7 +339,15 @@ export function validateTwoNumThree(rule, value, callback) { callback() } +// 数字格式 数字不可以大于5 +export function validateMaxNumber5(rule, value, callback) { + if (parseInt(value) <= 5) { + callback() + } else { + callback(new Error('不能大于5')) + } +} // 数字格式 小数点后三位 export function validateThreeNum(rule, value, callback) { if (value) { @@ -771,5 +779,6 @@ export default { validateFamilyPhone, validateName, validateChargeperson, - validateYS + validateYS, + validateMaxNumber5 }