feat: 获取扫码的参数

This commit is contained in:
2025-09-04 21:27:58 +08:00
parent 46a3b6a878
commit 613a2be148
5 changed files with 75 additions and 38 deletions

17
utils/UrlParams.js Normal file
View File

@@ -0,0 +1,17 @@
export function GetWxMiniProgramUrlParam(url) {
let theRequest = {};
if(url.indexOf("#") != -1){
const str=url.split("#")[1];
const strs=str.split("&");
for (let i = 0; i < strs.length; i++) {
theRequest[strs[i].split("=")[0]] = decodeURI(strs[i].split("=")[1]);
}
}else if(url.indexOf("?") != -1){
const str=url.split("?")[1];
const strs=str.split("&");
for (let i = 0; i < strs.length; i++) {
theRequest[strs[i].split("=")[0]] = decodeURI(strs[i].split("=")[1]);
}
}
return theRequest;
}