feat: 获取扫码的参数
This commit is contained in:
17
utils/UrlParams.js
Normal file
17
utils/UrlParams.js
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user