lyb-js 1.6.0 → 1.6.2
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.d.ts +1 -1
- package/Browser/LibJsPathParams.js +2 -2
- package/Browser/libJsParseQueryString.d.ts +7 -0
- package/Browser/libJsParseQueryString.js +5 -0
- package/README.md +10 -0
- package/libJs.d.ts +1 -1
- package/lyb.js +2 -2
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/** @description 获取浏览器地址栏参数
|
|
2
2
|
* @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsPathParams-地址栏参数
|
|
3
3
|
*/
|
|
4
|
-
export const libJsPathParams = () => {
|
|
5
|
-
const v = location.href;
|
|
4
|
+
export const libJsPathParams = (path) => {
|
|
5
|
+
const v = path || location.href;
|
|
6
6
|
const url = v.split("?")[1];
|
|
7
7
|
if (!url)
|
|
8
8
|
return {};
|
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/libJs.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ export declare const Browser: {
|
|
|
39
39
|
/** @description 获取浏览器地址栏参数
|
|
40
40
|
* @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsPathParams-地址栏参数
|
|
41
41
|
*/
|
|
42
|
-
libJsPathParams: () => Record<string, string>;
|
|
42
|
+
libJsPathParams: (path?: string) => Record<string, string>;
|
|
43
43
|
/** @description 动态设置网站标题及图标
|
|
44
44
|
* @param title 网站标题
|
|
45
45
|
* @param url 网站图标地址
|
package/lyb.js
CHANGED
|
@@ -86,8 +86,8 @@ ${log3.label}:`, log3.value];
|
|
|
86
86
|
const isTabletAspectRatio = aspectRatio >= 1.3 && aspectRatio <= 1.6;
|
|
87
87
|
return isTabletUserAgent || isTabletWidth && isTabletAspectRatio;
|
|
88
88
|
};
|
|
89
|
-
const libJsPathParams = () => {
|
|
90
|
-
const v = location.href;
|
|
89
|
+
const libJsPathParams = (path) => {
|
|
90
|
+
const v = path || location.href;
|
|
91
91
|
const url = v.split("?")[1];
|
|
92
92
|
if (!url)
|
|
93
93
|
return {};
|