1. URL 类获取特定query的参数
// 从当前 url 中获取 shortLink 参数 const curUrl = new URL(document.location) const curUrlParams = curUrl.searchParams const shortLink = curUrlParams.get('shortLink')
2. URLSearchParams 类获取特定query的参数
const urlSearchParams = new URLSearchParams('?name=mario') urlSearchParams.get('name') // => 'mario'