只需要在main.js里面写下面的那段代码,那么,以后往后端传的时候,就是表单的形式

// 在main.js中配置如下代码
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'
axios.defaults.transformRequest = [function (data) {
   
  let ret = ''
  for (const it in data) {
   
    ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
   }
  return ret
 }]





从浏览器里面可以看出,直接就是表单的形式