获取URL参数

// 获取url参数
function getUrlsParams(url) {
  console.log(url, 'url')
  const temp1 = url.split('?')
  const pram = temp1[1]
  const keyValue = pram.split('&')
  const obj = {}
  for (let i = 0; i < keyValue.length; i++) {
    const item = keyValue[i].split('=')
    const key = item[0]
    const value = item[1]
    obj[key] = value
  }
  return obj
}

你可能感兴趣的:(前端,javascript,vue.js)