提交 c4b22a22 编写于 作者: V Vben

fix(upload): make sure to carry custom parameters, fix #802

上级 60b80c96
...@@ -4,7 +4,8 @@ dist ...@@ -4,7 +4,8 @@ dist
.npmrc .npmrc
.cache .cache
test/server/static tests/server/static
tests/server/static/upload
.local .local
# local env files # local env files
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
### 🐛 Bug Fixes ### 🐛 Bug Fixes
- **Table** 修复分页抖动问题 - **Table** 修复分页抖动问题
- **Upload** 确保携带自定义参数
## 2.5.0(2021-06-20) ## 2.5.0(2021-06-20)
......
...@@ -5,7 +5,7 @@ import axios from 'axios'; ...@@ -5,7 +5,7 @@ import axios from 'axios';
import qs from 'qs'; import qs from 'qs';
import { AxiosCanceler } from './axiosCancel'; import { AxiosCanceler } from './axiosCancel';
import { isFunction } from '/@/utils/is'; import { isFunction } from '/@/utils/is';
import { cloneDeep } from 'lodash-es'; import { cloneDeep, omit } from 'lodash-es';
import { ContentTypeEnum } from '/@/enums/httpEnum'; import { ContentTypeEnum } from '/@/enums/httpEnum';
import { RequestEnum } from '/@/enums/httpEnum'; import { RequestEnum } from '/@/enums/httpEnum';
...@@ -136,8 +136,12 @@ export class VAxios { ...@@ -136,8 +136,12 @@ export class VAxios {
formData.append(key, params.data[key]); formData.append(key, params.data[key]);
}); });
} }
formData.append(params.name || 'file', params.file, params.filename); formData.append(params.name || 'file', params.file, params.filename);
const customParams = omit(params, 'file', 'filename', 'file');
Object.keys(customParams).forEach((key) => {
formData.append(key, customParams[key]);
});
return this.axiosInstance.request<T>({ return this.axiosInstance.request<T>({
...config, ...config,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册