JavaScript获取url参数 小柯Co 2019-04-16 233 阅读1分钟 const getParams = () => { let params = {}; let str = window.location.hash || window.location.search; str.slice(1).split('&').forEach((item) => params[item.split('=')[0]] = item.split('=')[1]); return params };