js 获取URL参数

in with 0 comment
const getQueryParams = (search = window.location.search) => {
  const searchParams = new URLSearchParams(search)
  const query = {}
  for (const p of searchParams) {
    const [key, value] = p
    query[key] = value
  }
  return query
}
Comments are closed.