axios以FormData转输数据时,并且转输的时候,要qs.stringify格式化。需要用到qs模块
const url = `/server/api/code/`;
axios.post(
url,
qs.stringify({mobile: '17664068406'}), // 传输时,需要字符化,并且要以import qs from 'qs';
{headers: {'Content-Type': 'application/x-www-form-urlencoded'}}
)
.then(function (response: any) {
console.log(response);
})
.catch(function (error: any) {
console.log(error);
});