xctc-utils 1.6.2 → 1.6.3
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.
- package/README.md +24 -4
- package/dist/params/index.d.ts +2 -1
- package/dist/params/index.js +6 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,13 +23,28 @@ all:boolean 为true时删除调用方法的所有缓存,否则只删除当前
|
|
|
23
23
|
如果 all 为 true 时,方法会优先执行缓存的clear函数, key 传任意值,
|
|
24
24
|
删除临时缓存: useUtils.removeSessionStorage(key,all)
|
|
25
25
|
删除永久缓存: useUtils.removeLocalStorage(key,all)
|
|
26
|
-
|
|
27
26
|
```
|
|
28
27
|
|
|
29
|
-
###
|
|
30
|
-
####
|
|
28
|
+
### 地址栏参数处理
|
|
29
|
+
#### 设置参数
|
|
31
30
|
```
|
|
32
|
-
|
|
31
|
+
interface SetOptions {
|
|
32
|
+
url:string, // 完整的 url 地址
|
|
33
|
+
data:string, // 具体需要拼接在地址参数
|
|
34
|
+
keyword:string, // 地址栏参数 key 值
|
|
35
|
+
key:string, // 参数加密 key
|
|
36
|
+
iv:string // 参数加密 iv
|
|
37
|
+
}
|
|
38
|
+
useUtils.params.set( options:SetOptions )
|
|
39
|
+
```
|
|
40
|
+
#### 获取参数
|
|
41
|
+
```
|
|
42
|
+
/**
|
|
43
|
+
* @param keys 需要截取地址栏参数键数组值,如: ['code','state']
|
|
44
|
+
* @param cache 是否需要缓存地址栏数据: 不传或传空,则不做处理,session 临时缓存 local永久缓存
|
|
45
|
+
* @param cacheKey 缓存数据的键 默认值 urlParamsData
|
|
46
|
+
*/
|
|
47
|
+
useUtils.params.get( keys:string[],cache?:string,cacheKey?:string )
|
|
33
48
|
```
|
|
34
49
|
|
|
35
50
|
### AES 加密、解密处理函数集合
|
|
@@ -186,3 +201,8 @@ useUtils.getIframeContentHeight("ueditor")
|
|
|
186
201
|
useUtils.findIdcardAge(idcard)
|
|
187
202
|
```
|
|
188
203
|
|
|
204
|
+
### 剪贴板操作集合
|
|
205
|
+
#### 将数据复制到剪贴板函数
|
|
206
|
+
```
|
|
207
|
+
useUtils.handleCopyValue(val)
|
|
208
|
+
```
|
package/dist/params/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export declare const set: (options: SetOptions) => string | undefined;
|
|
|
10
10
|
*
|
|
11
11
|
* @param keys 需要截取地址栏参数键数组值
|
|
12
12
|
* @param cache 是否需要缓存地址栏数据: 不传或传空,则不做处理,session 临时缓存 local永久缓存
|
|
13
|
+
* @param cacheKey 缓存数据的键 默认值 urlParamsData
|
|
13
14
|
*/
|
|
14
|
-
export declare const get: (keys: string[], cache?: string) => void;
|
|
15
|
+
export declare const get: (keys: string[], cache?: string, cacheKey?: string) => void;
|
|
15
16
|
export {};
|
package/dist/params/index.js
CHANGED
|
@@ -29,8 +29,9 @@ exports.set = set;
|
|
|
29
29
|
*
|
|
30
30
|
* @param keys 需要截取地址栏参数键数组值
|
|
31
31
|
* @param cache 是否需要缓存地址栏数据: 不传或传空,则不做处理,session 临时缓存 local永久缓存
|
|
32
|
+
* @param cacheKey 缓存数据的键 默认值 urlParamsData
|
|
32
33
|
*/
|
|
33
|
-
var get = function (keys, cache) {
|
|
34
|
+
var get = function (keys, cache, cacheKey) {
|
|
34
35
|
var win = window;
|
|
35
36
|
var loc = win.location;
|
|
36
37
|
var search = loc.search;
|
|
@@ -62,11 +63,13 @@ var get = function (keys, cache) {
|
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
65
|
}
|
|
66
|
+
if (!cacheKey)
|
|
67
|
+
cacheKey = "urlParamsData";
|
|
65
68
|
if (cache == "session") {
|
|
66
|
-
(0, storage_1.useSessionStorage)(
|
|
69
|
+
(0, storage_1.useSessionStorage)(cacheKey, paramsData);
|
|
67
70
|
}
|
|
68
71
|
if (cache == "local") {
|
|
69
|
-
(0, storage_1.useLocalStorage)(
|
|
72
|
+
(0, storage_1.useLocalStorage)(cacheKey, paramsData);
|
|
70
73
|
}
|
|
71
74
|
};
|
|
72
75
|
exports.get = get;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xctc-utils",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.3",
|
|
4
4
|
"description": "localStorage存储\r ```\r sessionStorage存储\r ```\r crypto-js加密、解密\r ```\r 微信授权登录、微信分享\r ```\r 设备环境获取\r ```\r 是否是微信浏览器\r ```\r 时间戳转时间,字符串转时间戳",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|