📜  js 将参数推送到 url - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:17.632000             🧑  作者: Mango

代码示例1
function setQueryStringParameter(name, value) {
    const params = new URLSearchParams(window.location.search);
    params.set(name, value);
    window.history.replaceState({}, "", decodeURIComponent(`${window.location.pathname}?${params}`));
}