url: https://www.baidu.com?test=111
let url = new URL(window.location.href);
let parameterZ = url.searchParams.get("test");
console.log(parameterZ); // 111
如果获取没有的属性返回null
let id = url.searchParams.get("id"); // null
2023-10-30 09:39:46
url: https://www.baidu.com?test=111
let url = new URL(window.location.href);
let parameterZ = url.searchParams.get("test");
console.log(parameterZ); // 111
如果获取没有的属性返回null
let id = url.searchParams.get("id"); // null