export const serialize = function(obj) { const ary = []; for (let p in obj) if (obj.hasOwnProperty(p) && obj[p]) { ary.push(encodeURIComponent(p) + '=' + encodeURIComponent(obj[p])); } return ary.join('&'); };
js get url 传递object
8 min read
export const serialize = function(obj) { const ary = []; for (let p in obj) if (obj.hasOwnProperty(p) && obj[p]) { ary.push(encodeURIComponent(p) + '=' + encodeURIComponent(obj[p])); } return ary.join('&'); };