javaLuo / react-admin

动态菜单配置、权限精确到按钮、通用模块;标准后台管理系统解决方案
https://isluo.com/work/admin/
Mulan Permissive Software License, Version 2
493 stars 146 forks source link

您好 想请教一下项目中设置了请求头"Content-Type": "application/x-www-form-urlencoded; charset=utf-8",格式,post请求怎么转换为右边中的格式呢 #16

Closed menglin1997 closed 3 years ago

menglin1997 commented 3 years ago

image 设置了请求头"Content-Type": "application/x-www-form-urlencoded; charset=utf-8",格式,post请求怎么转换为上图中右边中的格式呢,左边的是实际得到的参数格式

下图为请求方式 image

javaLuo commented 3 years ago

小伙子听说过qs库吗。

import qs from "qs";

const res : Res = await axios({
  method:'post',
  url: '....',
  data: qs.stringify(params)
});
menglin1997 commented 3 years ago

长见识了 我不是小伙子