Skip to content

Commit aad94b2

Browse files
committed
通用下载方法新增config配置选项
1 parent 9290e3c commit aad94b2

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/components/FileUpload/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ const emit = defineEmits();
7070
const number = ref(0);
7171
const uploadList = ref([]);
7272
const baseUrl = import.meta.env.VITE_APP_BASE_API;
73-
const uploadFileUrl = ref(import.meta.env.VITE_APP_BASE_API + "/common/upload"); // 上传的图片服务器地址
73+
const uploadFileUrl = ref(import.meta.env.VITE_APP_BASE_API + "/common/upload"); // 上传文件服务器地址
7474
const headers = ref({ Authorization: "Bearer " + getToken() });
7575
const fileList = ref([]);
7676
const showTip = computed(

src/utils/request.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,13 @@ service.interceptors.response.use(res => {
130130
)
131131

132132
// 通用下载方法
133-
export function download(url, params, filename) {
133+
export function download(url, params, filename, config) {
134134
downloadLoadingInstance = ElLoading.service({ text: "正在下载数据,请稍候", background: "rgba(0, 0, 0, 0.7)", })
135135
return service.post(url, params, {
136136
transformRequest: [(params) => { return tansParams(params) }],
137137
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
138-
responseType: 'blob'
138+
responseType: 'blob',
139+
...config
139140
}).then(async (data) => {
140141
const isLogin = await blobValidate(data);
141142
if (isLogin) {

0 commit comments

Comments
 (0)