上传文件-formData形式接口传参文件外其他参数
const service = axios.create({});
let formData = new FormData(); formData.append('file', file.file.originFileObj);//文件 formData.append('req', JSON.stringify(req));//其他参数 const res = await service({ url: '', method: 'POST', transformRequest: [function (data, headers) { // 去除post请求默认的Content-Type delete headers.post['Content-Type'] return data }], data: formData })