封装一个方法获取页面url参数,可作为框架基础方法使用:
//获取url参数; 正则获取url参数,包含hash[#]和search[?]两种通用
export function getUrlQueryByName(param) {
const reg = new RegExp('(^|&)' + param + '=([^&]*)(&|$)');
const r =
window.location.search.substr(1).match(reg) ||
window.location.hash
.substring(window.location.hash.search(/\?/) + 1)
.match(reg);
if (r != null) {
return decodeURIComponent(r[2]);
}
}
卡布奇诺今犹在,不见当年倒茶人~😌
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。