从https://www.baidu.com?name=test中获取name的值
getQueryString(urlString,name){
return new URLSearchParams(urlString.split('?')[1]).get(name) || '';
}
let url = "https://www.baidu.com?name=test";
getQueryString(url,"name");// test
从https://www.baidu.com?name=test中获取name的值
getQueryString(urlString,name){
return new URLSearchParams(urlString.split('?')[1]).get(name) || '';
}
let url = "https://www.baidu.com?name=test";
getQueryString(url,"name");// test