1 parent 494a7d0 commit e8e014cCopy full SHA for e8e014c
src/utils.js
@@ -111,21 +111,9 @@ export function 不讲武德() {
111
),
112
});
113
}
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
+export function getUrlParameter(key) {
+ const searchParams = new URLSearchParams(window.location.search);
+ return searchParams.get(key);
129
130
131
export function uuidv4() {
0 commit comments