把location.search处理成一个对象
2018-12-20 本文已影响0人
yorickJin
function parseUrlParams() {
if (window.location.search.length <= 0) return false;
var info = window.location.search.slice(1);
var result = {};
info.split('&').foreach(item => {
result[decodeURIComponent(item.split('=')[0])] = decodeURIComponent(item.split('=')[1]);
});
return result;
}