fix: bug#16356

This commit is contained in:
leiqiaochu 2023-07-14 14:11:36 +08:00
parent c0bcccbfaf
commit 94e92acfdf
1 changed files with 15 additions and 0 deletions

View File

@ -132,6 +132,16 @@ const validateAddress = (_rule: any, value: string): Promise<any> => {
});
};
const sizeValidator = (_rule:any, value: number):Promise<any> =>{
return new Promise(async(resolve,reject)=>{
const posReg = /^\d+$/;
if(posReg.test(value.toString()) && value >= 0 && value <=65535 ){
return resolve('');
}else {
return reject(_rule.message);
}
})
}
export const Rules = {
name: [
{
@ -313,6 +323,11 @@ export const Rules = {
required: true,
message: '请输入长度值',
},
{
validator:sizeValidator,
message:'请输入0~65535之间的正整数',
trigger:'change'
}
],
length: [
{