获取地址栏参数对象

const queryStringObj = () => {
  let searchParams: any = new URLSearchParams(window.location.search);
  // 输出键值对
  let obj: any = {};
  for (var key of searchParams.keys()) {
    obj[key] = searchParams.get(key);
  }
  return obj;
};

你可能感兴趣的:(JavaScript,基础知识,javascript)