const getUrlParam = (name) => {let reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)')if( !window.location.href.includes('?')) returnlet r = window.location.href.split("?")[1].match(reg)if (r != null) return unescape(r[2])return null}//备注:window.location.search有时候获取不到值, window.location.href.split("?")[1]等价于//window.location.search.substr(1)“(^|&)” + name + "=([^&]*)(&|$)的含义 :匹配以&name=开头或者空白name=开头中间为任意多个除了&以外的字符 一旦遇到&或者空白就中止取值

