通过location.search可以获取到url拼接的参数(前面带有?号)
function getUrlParams(name) {
let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
let param = window.location.search.substr(1).match(reg);
return param && param[2];
}
通过location.search可以获取到url拼接的参数(前面带有?号)
function getUrlParams(name) {
let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
let param = window.location.search.substr(1).match(reg);
return param && param[2];
}