Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
data-table
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
hookehuyr
2022-12-22 11:23:40 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
7b24d665eabbf7c56df9854e2210897564bea917
7b24d665
1 parent
4b624064
手机号控件修改
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
src/components/PhoneField/index.vue
src/components/PhoneField/index.vue
View file @
7b24d66
<!--
* @Date: 2022-09-02 10:46:03
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-12-
09 13:34:21
* @LastEditTime: 2022-12-
22 11:14:12
* @FilePath: /data-table/src/components/PhoneField/index.vue
* @Description: 手机输入框
-->
...
...
@@ -65,16 +65,17 @@ const is_sms = ref(false);
// 校验函数返回 true 表示校验通过,false 表示不通过
const validator = (val) => {
if (!props.item.component_props.required) {
// 非必填
return true;
if (props.item.component_props.required && !val) {
return false;
} else if (!/1\d{10}/.test(val)) {
return false;
} else {
return
/1\d{10}/.test(val)
;
return
true
;
}
};
// 错误提示文案
const validatorMessage = (val, rule) => {
if (!val) {
if (
props.item.component_props.required &&
!val) {
return "手机号码不能为空";
} else if (!/1\d{10}/.test(val)) {
return "请输入正确手机号码";
...
...
Please
register
or
login
to post a comment