Axios post bugs All In One
Axios post bugs All In One
solution
屏蔽细节
import axios from '@/utils/http.js';
// 保存创意
const axiosUtils = (url = '', params = {}, type = 'get') => {
if(!url) {
throw new Error('❌ API URL 不可为空!');
// return;
}
// switch...case
if(type === 'get') {
// multipart/form-data ✅
return axios.post(url, {params});
}
if(type === 'post') {
// application/x-www-form-urlencoded ✅✅
return axios.post(url, params);
}
if(type === 'put') {
// multipart/form-data ✅✅
return axios.post(url, params);
}
};
refs
https://github.com/xgqfrms/FEIQA/issues/107
©xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/14791070.html
未经授权禁止转载,违者必究!