js获取地址栏参数
js获取地址栏参数
js获取地址栏参数:
getParam(name) { return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.href) || [, ""])[1].replace(/\+/g, '%20')) || null }
URLSearchParams
getParam(name){
var obj = new URLSearchParams(window.location.search);
return obj.get(name);
}
URLSearchParams 其他方法 参考 https://www.cnblogs.com/zshno1/p/15993017.html
浙公网安备 33010602011771号