1、获取url参数,键值对形式返回。
const getParams = () => {
let params = window.location.search;
let obj = {};
if (params.indexOf('?') != -1) {
let str = params.substr(1).split('&');
for (let i = 0; i < str.length; i++) {
obj[str[i].split('=')[0]] = unescape(str[i].split('=')[1]);
}
}
return obj;
}