hookehuyr

fix

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