1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
| export default {
| /* 大陆手机号码 */
| mobile(val){
| return /^[1][3,4,5,6,7,8,9][0-9]{9}$/.test(val)
| },
| /* 大陆固定电话 */
| telephone(val){
| return /^(([0\+]\d{2,3}-)?(0\d{2,3})-)(\d{7,8})(-(\d{3,}))?$/.test(val)
| },
| /* 电子邮箱 */
| email(val){
| return /^w+([-+.]w+)*@w+([-.]w+)*.w+([-.]w+)*$/.test(val)
| },
| /* 正整数 */
| positiveInteger(val){
| let tp = typeof(val);
| if (tp==='number') {
| val = val.toString();
| }
| if (tp==='string') {
| if (!val) {
| return true;
| } else {
| return /^[1-9]\d*$/.test(val)
| }
| } else {
| return false;
| }
| }
| }
|
|