File tree 2 files changed +26
-7
lines changed
2 files changed +26
-7
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ npm run build
52
52
- [ ] 微信分享给朋友
53
53
- [ ] 微信支付
54
54
- [ ] 定制主题
55
+ - [ ] 页面路由缓存栈
55
56
56
57
## 项目截图
57
58
上传图片会被截掉,换成点链接查看
@@ -123,3 +124,8 @@ css: {
123
124
}
124
125
```
125
126
127
+ ## 联系我
128
+ 舒志平
129
+
130
+
131
+ 微信:f144270
Original file line number Diff line number Diff line change 1
1
/**
2
- * 是否是字符串
2
+ * 是否是字符串类型
3
3
* @param {string } str
4
4
*/
5
5
export function isString ( str ) {
@@ -10,7 +10,7 @@ export function isString(str) {
10
10
}
11
11
12
12
/**
13
- * 是否是字符串
13
+ * 是否是数组类型
14
14
* @param {array } arg
15
15
*/
16
16
export function isArray ( arg ) {
@@ -21,18 +21,31 @@ export function isArray(arg) {
21
21
}
22
22
/**
23
23
* 是否是手机号码格式
24
- * @param {array } arg
24
+ * @param {string } value
25
25
*/
26
26
export function isPhone ( value ) {
27
27
const reg = / ^ 1 [ 0 - 9 ] { 10 } $ /
28
28
return reg . test ( value )
29
29
}
30
30
/**
31
- * 是否为空字符串
32
- * @param {string } value
31
+ * 是否为空数据
32
+ * @param {* } obj
33
33
*/
34
- export function isEmpty ( value ) {
35
- return ! `${ value } ` . trim ( ) . length
34
+
35
+ export function isEmpty ( obj ) {
36
+ if ( obj == null ) {
37
+ return true
38
+ }
39
+ if ( isArray ( obj ) ) {
40
+ return obj . length === 0
41
+ }
42
+ if ( isString ( obj ) ) {
43
+ return ! `${ obj } ` . trim ( ) . length
44
+ }
45
+ if ( JSON . stringify ( obj ) === '{}' ) {
46
+ return true
47
+ }
48
+ return true
36
49
}
37
50
/**
38
51
* 是否是邮箱格式
You can’t perform that action at this time.
0 commit comments