使用URL 对象获取参数

  const url =
   'https://test.iha0517.net/smartCity/H5/H5Login/index.html?ak=9ce9d206-7738-40a2-bac2-3db262c40c64&inviteCode=ZCAT&type=2×tamp=1659943721974&activityName=%27%E9%82%80%E6%96%B0%E6%B4%BB%E5%8A%A8%27&activityId=%27%27#/'

  const urlObj = new URL(url)

  const paramsValue = urlObj.searchParams.get('activityName')

  console.log(' paramsValue', paramsValue)

你可能感兴趣的:(使用URL 对象获取参数)