js将url查询字符串转换为json数据
function query2Hash(queryStr) { var h = {}; console.log(window.location.search); var qArr = (queryStr || window.location.search.replace(/\?/, '')).split('&'); for (var i = 0, len = qArr.length; i < len; i += 1) { var kvArr = qArr[i].split('='); h[kvArr[0]] = kvArr[1]; } return h; }