1、用于获取url中的参数
function getQueryVariable(variable)
{
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if(pair[0] == variable){return pair[1];}
}
return(false);
}
比如当前url 为 ‘http://localhost:8888/detail?id=1&u_id=24&u_name=zhangsan’
let u_id = getQueryVariable('u_id'); //24
let u_name = getQueryVariable('u_name'); //zhangsan