JS获取url参数方法 function getQueryParams() { let obj = {} if (!location.search) return obj let queryStrAtt = location.search.replace('?', '').split('&') queryStrAtt.forEach(r => { let arr = r.split('=') obj[arr[0]] = arr[1] }) return obj }