例如:https://ccty-t/qrcode-valid/share?code=111
const decodedString = decodeURIComponent(params.q);
const objParams = this.getUrlParams(decodedString);
getUrlParams(url) {
let formateUrl = url.slice(url.indexOf('?'));
let index = formateUrl.indexOf('?');
let obj = {};
if (index !== -1) {
let str = formateUrl.substr(1);
let arr = str.split('&');
for (let i = 0; i < arr.length; i++) {
obj[arr[i].split('=')[0]] = arr[i].split('=')[1];
}
}
return obj;
},
获取{code:111}