hookehuyr

fix

<!--
* @Date: 2022-09-02 10:46:03
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-12-22 11:14:12
* @LastEditTime: 2022-12-22 11:27:11
* @FilePath: /data-table/src/components/PhoneField/index.vue
* @Description: 手机输入框
-->
......@@ -67,7 +67,7 @@ const is_sms = ref(false);
const validator = (val) => {
if (props.item.component_props.required && !val) {
return false;
} else if (!/1\d{10}/.test(val)) {
} else if (val && !/1\d{10}/.test(val)) {
return false;
} else {
return true;
......@@ -77,7 +77,7 @@ const validator = (val) => {
const validatorMessage = (val, rule) => {
if (props.item.component_props.required && !val) {
return "手机号码不能为空";
} else if (!/1\d{10}/.test(val)) {
} else if (val && !/1\d{10}/.test(val)) {
return "请输入正确手机号码";
}
};
......