declare function unescape(string: string): string; // 引用
// 使用
getUrlParam(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
// console.log(reg);
var r = decodeURI(window.location.search).substr(1).match(reg); //匹配目标参数
// console.log(window.location.search.substr(1).match(reg));
if (r != null) return unescape(r[2]);
return null; //返回参数值
}
获取url的参数:getUrlParam
最新推荐文章于 2024-05-14 16:48:12 发布