获取URL参数
var urlParams = getUrlParams();
function getUrlParams(){
var url = document.URL;
let urlStr = url.split('?')[1]
let obj = {};
if (urlStr) {
let paramsArr = urlStr.split('&')
for(let i = 0,len = paramsArr.length;i < len;i++){
let arr = paramsArr[i].split('=')
obj[arr[0]] = decodeURI(arr[1]); //对 encodeURI() 函数编码过的 URI 进行解码
}
}
return obj
};