Skip to content

Commit e8e014c

Browse files
author
lucifer
committed
fix: searchParams
1 parent 494a7d0 commit e8e014c

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

‎src/utils.js

+3-15
Original file line numberDiff line numberDiff line change
@@ -111,21 +111,9 @@ export function 不讲武德() {
111111
),
112112
});
113113
}
114-
export function getUrlParameter(sParam) {
115-
const sPageURL = window.location.search.substring(1),
116-
sURLVariables = sPageURL.split("&"),
117-
sParameterName,
118-
i;
119-
120-
for (i = 0; i < sURLVariables.length; i++) {
121-
sParameterName = sURLVariables[i].split("=");
122-
123-
if (sParameterName[0] === sParam) {
124-
return sParameterName[1] === undefined
125-
? true
126-
: decodeURIComponent(sParameterName[1]);
127-
}
128-
}
114+
export function getUrlParameter(key) {
115+
const searchParams = new URLSearchParams(window.location.search);
116+
return searchParams.get(key);
129117
}
130118

131119
export function uuidv4() {

0 commit comments

Comments
 (0)