此方法用来提取url的search中携带的指定参数
function getQueryString(name) {
const reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i')
const r = decodeURI(location.search.substr(1)).match(reg)
if (r != null) {
return unescape(r[2])
}
return null
}
提取参数'wd'的值:getQueryString('wd')