因為默認數(shù)據(jù)格式為json,發(fā)請求時參數(shù)報錯
通過以下方式修改數(shù)據(jù)格式即可
import qs from 'qs';
const data = { 'bar': 123 };
const options = {
method: 'POST',
headers: { 'content-type': 'application/x-www-form-urlencoded' },
data: qs.stringify(data),
url,
};
axios(options);