Field 必填问题 #11650
qinjiaqiang
started this conversation in
General
Field 必填问题
#11650
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
需求是这样:输入有内容的时候验证输入内容的格式,没内容的不需要验证。比如验证手机号格式如下
:rules="[{ required: isContactPhone, pattern:/^1[3|4|5|7|8|9][0-9]\d{8}$/, message: '手机号格式错误', trigger: 'onSubmit' }]"
如果有内容的时候isContactPhone为true;没内容的时候,isContactPhone为false.
但实际上不管isContactPhone为true还是false, 都验证了
Beta Was this translation helpful? Give feedback.
All reactions