//参数数组 返回值:{} var keys=['name','age']
function queryParams(keys){
var localtion=new URLSearchParams(window.location.href)
return keys.reduce((preState,current)=>{
return {...preState,[current]:localtion.get(current)}
},{})
}
console.log(queryParams(keys))