js对象格式化为表单数据

只适用于 简单的数据转换

function (data) {
              // Do whatever you want to transform the data
              let ret = ''
              for (let it in data) {
                ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
              }
              return ret .slice(0,-1) //删除最后一个&
 }
原文地址:https://www.cnblogs.com/shiazhen/p/12890450.html