twmodule 0.0.23 → 0.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +21 -23
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -19,45 +19,43 @@ npm run test
19
19
  ## 组件库说明
20
20
  ### 公共方法
21
21
  ```
22
- 1、changeDate(time, type) //时间格式化
22
+ 1、formatDate(time, fmt) //时间格式化
23
23
  参数说明:
24
24
  time:传入的时间
25
- type:格式化后返回的格式
26
- 默认:2020-01-01
27
- date2:20200101
28
- dateStr:2020年01月01日
29
- month :2020-01
30
- month2 :202001
31
- monthStr : 2020年01月
32
- year : 2020
33
- yearStr:2020年
34
- dataTime :2020-01-01 01:01:01
35
- before : 原始的数据格式
36
- ---后续根据项目需求会加入更多格式---
25
+ fmt:期望的格式(yyyy年MM月dd日 hh时mm分ss秒)
37
26
 
38
- 2、changeNum(num,changeType) //数字格式化
27
+ 2、changeNum(num,changeType,len) //数字格式化
39
28
  参数说明:
40
29
  num:传入的数字
41
30
  changeType:格式化后返回的格式
42
- 默认:保留2位小数
43
- tofixed3:保留三位小数
44
- comma :保留2位小数,正数部分添加千分位符号 //10,000.00
45
- comma3 :保留3位小数,正数部分添加千分位符号
46
- percent :保留两位添加百分号
47
- ---后续根据项目需求会加入更多格式---
31
+ comma :正数部分添加千分位符号 //10,000.00
32
+ percent :添加百分号
33
+ len:所有类型保留几位小数,默认保留2位小数。
48
34
 
49
- 3、sortFunc(arr,word,type) //数组对象的排序
35
+ 3、sortFunc(arr,word,type,isDate) //数组对象的排序
50
36
  参数说明:
51
37
  arr:传入的数组
52
38
  word:按照对象中的某个字段排序(字段值为可以比较大小的内容,比如时间或数字)
53
39
  type:排序规则
54
- 默认:正序
55
- 任意值:倒序
40
+ 默认||asc:升序
41
+ 任意值:降序
42
+ isDate:是否是按时间排序
56
43
 
57
44
  4、urlSearch(name) //获取路由中的参数
58
45
  参数说明:
59
46
  name:参数名
60
47
 
48
+ 5、deepClone(obj)//深度克隆
49
+
50
+ 6、getObjFromList(arr,key,value,child,currObj)//从多层级数组中获取指定key:value的该对象
51
+ arr:数组
52
+ key:key值
53
+ value:value值
54
+ child:子级名字
55
+ currObj:承接返回对象的对象名
56
+
57
+ 7、delRepeat(arr)数组去重
58
+ 8、delRepeatObj(arr,keyWord)数组对象去重
61
59
  ```
62
60
  ### 公共样式
63
61
  #### 1、字体
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "twmodule",
3
- "version": "0.0.23",
3
+ "version": "0.0.24",
4
4
  "private": false,
5
5
  "description":"通威组件库",
6
6
  "main":"lib/twComp.umd.min.js",