这样写了之后 会提示接口404 并且传的值最后有一empty
1 回答
慕尼黑8549860
TA贡献1818条经验 获得超11个赞
axios({
url: '/user',
method: 'post',
data: {
firstName: 'Fred',
lastName: 'Flintstone'
},
transformRequest: [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
}],
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
})
添加回答
举报
0/150
提交
取消