分离查询参数
2018-05-08 本文已影响0人
Venvivo
let url = window.location.href;
let query = url.split("?")[1];
let queryArr = query.split("&");
let obj = {};
for (let i = 0; i < queryArr.length; i++) {
let value = queryArr[i].split("=")[1];
let key = queryArr[i].split("=")[0];
obj[key]= value;
}
console.log(obj);