从url中获取参数名为name的参数值的方法:
getUrlParam(name) {
let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");let r = window.location.search.substr(1).match(reg);if (r != null) {
return unescape(r[2]);}return null;
},
例如当前页面链接是:
let link = https://www.test.com/?t=2351
this.getUrlParam(t)
得到的结果是:2351