zmdms-utils 0.0.60 → 0.0.61

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/dist/es/common.js CHANGED
@@ -76,7 +76,19 @@ function parseQueryParams(url) {
76
76
  var searchList = queryString.split("&");
77
77
  for (var i = 0; i < searchList.length; i++) {
78
78
  var _a = searchList[i].split("="), key = _a[0], value = _a[1];
79
- result[key] = value;
79
+ var val = decodeURIComponent(value);
80
+ if (val.startsWith("{")) {
81
+ try {
82
+ val = JSON.parse(val);
83
+ }
84
+ catch (err) {
85
+ console.log("解析失败", err);
86
+ }
87
+ }
88
+ else if (val === "true" || val === "false") {
89
+ val = val === "true";
90
+ }
91
+ result[key] = val;
80
92
  }
81
93
  }
82
94
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zmdms-utils",
3
- "version": "0.0.60",
3
+ "version": "0.0.61",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
package/src/common.ts CHANGED
@@ -81,7 +81,17 @@ export function parseQueryParams(url: string): { [key: string]: string } {
81
81
  const searchList = queryString.split("&");
82
82
  for (let i = 0; i < searchList.length; i++) {
83
83
  const [key, value] = searchList[i].split("=");
84
- result[key] = value;
84
+ let val: any = decodeURIComponent(value);
85
+ if (val.startsWith("{")) {
86
+ try {
87
+ val = JSON.parse(val);
88
+ } catch (err) {
89
+ console.log("解析失败", err);
90
+ }
91
+ } else if (val === "true" || val === "false") {
92
+ val = val === "true";
93
+ }
94
+ result[key] = val;
85
95
  }
86
96
  }
87
97
  } catch (err) {