vue获取url中的参数(兼容hash模式)
getQueryString = (name, search) => {search = search ||window.location.search.substr(1) || window.location.hash.split("?")[1];let reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");let r =
·
getQueryString = (name, search) => {
search = search || window.location.search.substr(1) || window.location.hash.split("?")[1];
let reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
let r = search.match(reg);
if (r != null) return unescape(r[2]); return null;
}
更多推荐
已为社区贡献8条内容
所有评论(0)