获取地址
const getTopUrl = () => {
return window.location.href.split("/#/")[0];
}
获取url参数
name传参数名
const getQueryString = (name) => {
let reg = new RegExp("(^|&)" + name + “=([^&]*)(&|$)”, “i”);
let r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(decodeURI(r[2]));
return null;
}