tools-min-ns 1.9.3 → 1.9.4
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 +4 -0
- package/esm/url/UrlUtil.js +19 -8
- package/lib/url/UrlUtil.js +19 -8
- package/package.json +1 -1
package/README.md
CHANGED
package/esm/url/UrlUtil.js
CHANGED
|
@@ -76,19 +76,22 @@ var UrlUtil;
|
|
|
76
76
|
* getUrlRequest('https://ss.cn?sdf=213&bdl=231111'); => {sdf: "213", bdl: "231111"}
|
|
77
77
|
*/
|
|
78
78
|
function getUrlRequest(href) {
|
|
79
|
-
var _a;
|
|
80
79
|
if (href === void 0) {
|
|
81
80
|
href = window.location.href;
|
|
82
81
|
}
|
|
83
|
-
href = href.
|
|
82
|
+
href = "".concat(href === null || href === void 0 ? void 0 : href.slice(-1)) === '/' ? href === null || href === void 0 ? void 0 : href.slice(0, href.length - 1) : href;
|
|
84
83
|
var theRequest = {};
|
|
85
|
-
if (href.includes('
|
|
86
|
-
|
|
84
|
+
if (href.includes('#/')) {
|
|
85
|
+
//hash
|
|
86
|
+
href = "".concat(href.split('/').slice(-1));
|
|
87
|
+
}
|
|
88
|
+
if (href === null || href === void 0 ? void 0 : href.includes('?')) {
|
|
89
|
+
var strs = href === null || href === void 0 ? void 0 : href.split('?').slice(-1).toString().split('&');
|
|
87
90
|
for (var i = 0; i < strs.length; i++) {
|
|
88
|
-
var
|
|
89
|
-
key =
|
|
90
|
-
value =
|
|
91
|
-
if (key) theRequest[key] =
|
|
91
|
+
var _a = __read(strs[i].split('='), 2),
|
|
92
|
+
key = _a[0],
|
|
93
|
+
value = _a[1];
|
|
94
|
+
if (key) theRequest[key] = decodeURIComponent(value);
|
|
92
95
|
}
|
|
93
96
|
}
|
|
94
97
|
return theRequest;
|
|
@@ -101,6 +104,14 @@ var UrlUtil;
|
|
|
101
104
|
function setUrlParamsNotRefresh(obj) {
|
|
102
105
|
var urlParams = getUrlRequest();
|
|
103
106
|
var str = objToUrlParam(ObjectUtil.mergeParams(obj, urlParams));
|
|
107
|
+
var href = window.location.href;
|
|
108
|
+
if (href.includes('#/') && !"".concat(href.split('/').slice(-1)).includes('?')) {
|
|
109
|
+
var url_1 = "".concat(href).concat(str ? "?".concat(str) : '');
|
|
110
|
+
window.history.replaceState({
|
|
111
|
+
url: url_1
|
|
112
|
+
}, '', url_1);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
104
115
|
var _arr = window.location.href.split('?');
|
|
105
116
|
var url = "".concat(_arr.slice(0, _arr.length - 1).join('?')).concat(str ? "?".concat(str) : '');
|
|
106
117
|
window.history.replaceState({
|
package/lib/url/UrlUtil.js
CHANGED
|
@@ -86,19 +86,22 @@ var UrlUtil;
|
|
|
86
86
|
* getUrlRequest('https://ss.cn?sdf=213&bdl=231111'); => {sdf: "213", bdl: "231111"}
|
|
87
87
|
*/
|
|
88
88
|
function getUrlRequest(href) {
|
|
89
|
-
var _a;
|
|
90
89
|
if (href === void 0) {
|
|
91
90
|
href = window.location.href;
|
|
92
91
|
}
|
|
93
|
-
href = href.
|
|
92
|
+
href = "".concat(href === null || href === void 0 ? void 0 : href.slice(-1)) === '/' ? href === null || href === void 0 ? void 0 : href.slice(0, href.length - 1) : href;
|
|
94
93
|
var theRequest = {};
|
|
95
|
-
if (href.includes('
|
|
96
|
-
|
|
94
|
+
if (href.includes('#/')) {
|
|
95
|
+
//hash
|
|
96
|
+
href = "".concat(href.split('/').slice(-1));
|
|
97
|
+
}
|
|
98
|
+
if (href === null || href === void 0 ? void 0 : href.includes('?')) {
|
|
99
|
+
var strs = href === null || href === void 0 ? void 0 : href.split('?').slice(-1).toString().split('&');
|
|
97
100
|
for (var i = 0; i < strs.length; i++) {
|
|
98
|
-
var
|
|
99
|
-
key =
|
|
100
|
-
value =
|
|
101
|
-
if (key) theRequest[key] =
|
|
101
|
+
var _a = __read(strs[i].split('='), 2),
|
|
102
|
+
key = _a[0],
|
|
103
|
+
value = _a[1];
|
|
104
|
+
if (key) theRequest[key] = decodeURIComponent(value);
|
|
102
105
|
}
|
|
103
106
|
}
|
|
104
107
|
return theRequest;
|
|
@@ -111,6 +114,14 @@ var UrlUtil;
|
|
|
111
114
|
function setUrlParamsNotRefresh(obj) {
|
|
112
115
|
var urlParams = getUrlRequest();
|
|
113
116
|
var str = objToUrlParam(ObjectUtil_1.default.mergeParams(obj, urlParams));
|
|
117
|
+
var href = window.location.href;
|
|
118
|
+
if (href.includes('#/') && !"".concat(href.split('/').slice(-1)).includes('?')) {
|
|
119
|
+
var url_1 = "".concat(href).concat(str ? "?".concat(str) : '');
|
|
120
|
+
window.history.replaceState({
|
|
121
|
+
url: url_1
|
|
122
|
+
}, '', url_1);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
114
125
|
var _arr = window.location.href.split('?');
|
|
115
126
|
var url = "".concat(_arr.slice(0, _arr.length - 1).join('?')).concat(str ? "?".concat(str) : '');
|
|
116
127
|
window.history.replaceState({
|