带#获取地址栏参数

GetQueryString(name) {
let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
if(window.location.hash.indexOf("?") < 0){
return null;
}
let r = window.location.hash.split("?")[1].match(reg);   
if (r != null) return decodeURIComponent(r[2]);
   return null;
},

posted @ 2021-12-21 14:45  木头小屋  阅读(95)  评论(0)    收藏  举报