lyb-js 1.6.1 → 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/Browser/LibJsObjToUrlParams.d.ts +1 -1
- package/Browser/LibJsObjToUrlParams.js +1 -1
- package/Browser/LibJsPathParams.js +2 -1
- package/Browser/libJsParseQueryString.d.ts +7 -0
- package/Browser/libJsParseQueryString.js +5 -0
- package/README.md +10 -0
- package/lyb.js +1 -1
- package/package.json +1 -1
|
@@ -7,7 +7,8 @@ export const libJsPathParams = (path) => {
|
|
|
7
7
|
if (!url)
|
|
8
8
|
return {};
|
|
9
9
|
const params = url.split("&").reduce((pre, cur) => {
|
|
10
|
-
const [k, v] = cur.split(/=(.+)/);
|
|
10
|
+
const [k, v] = cur.split(/=(.+)/).map(decodeURIComponent);
|
|
11
|
+
;
|
|
11
12
|
return (pre[k] = v), pre;
|
|
12
13
|
}, {}) || {};
|
|
13
14
|
return params;
|
package/README.md
CHANGED
|
@@ -75,6 +75,8 @@ console.log(t); //"string"
|
|
|
75
75
|
|
|
76
76
|
\- [LibJsPathParams-地址栏参数](#LibJsPathParams-地址栏参数)
|
|
77
77
|
|
|
78
|
+
\- [LibJsParseQueryString-URL参数转对象](#LibJsParseQueryString-URL参数转对象)
|
|
79
|
+
|
|
78
80
|
\- [LibJsSetTitleIcon-网站标题图标](#LibJsSetTitleIcon-网站标题图标)
|
|
79
81
|
|
|
80
82
|
\- [LibJsTagTitleTip-网站标题交互](#LibJsTagTitleTip-网站标题交互)
|
|
@@ -241,6 +243,14 @@ const params = libJsPathParams();
|
|
|
241
243
|
console.log(params); //{ param1: "value1", param2: "value2" }
|
|
242
244
|
```
|
|
243
245
|
|
|
246
|
+
### LibJsParseQueryString-URL参数转对象
|
|
247
|
+
|
|
248
|
+
> 将`URL`参数转为对象
|
|
249
|
+
|
|
250
|
+
```ts
|
|
251
|
+
libJsParseQueryString("name=lengyibai&age=18"); //{name: "lengyibai", age: "18"}
|
|
252
|
+
```
|
|
253
|
+
|
|
244
254
|
### LibJsSetTitleIcon-网站标题图标
|
|
245
255
|
|
|
246
256
|
> 动态设置网站标题及图标,涉及到不同平台的打包,可以根据不同环境来设置网站标题和图标
|
package/lyb.js
CHANGED
|
@@ -92,7 +92,7 @@ ${log3.label}:`, log3.value];
|
|
|
92
92
|
if (!url)
|
|
93
93
|
return {};
|
|
94
94
|
const params = url.split("&").reduce((pre, cur) => {
|
|
95
|
-
const [k, v2] = cur.split(/=(.+)/);
|
|
95
|
+
const [k, v2] = cur.split(/=(.+)/).map(decodeURIComponent);
|
|
96
96
|
return pre[k] = v2, pre;
|
|
97
97
|
}, {}) || {};
|
|
98
98
|
return params;
|