|
@@ -174,7 +174,7 @@
|
|
// }
|
|
// }
|
|
|
|
|
|
async function uploadApiByItem(item: FileItem) {
|
|
async function uploadApiByItem(item: FileItem) {
|
|
- const { api } = props;
|
|
|
|
|
|
+ const { api, afterFetch } = props;
|
|
if (!api || !isFunction(api)) {
|
|
if (!api || !isFunction(api)) {
|
|
return warn('upload api must exist and be a function');
|
|
return warn('upload api must exist and be a function');
|
|
}
|
|
}
|
|
@@ -197,6 +197,10 @@
|
|
item.status = UploadResultStatus.SUCCESS;
|
|
item.status = UploadResultStatus.SUCCESS;
|
|
item.responseData = data;
|
|
item.responseData = data;
|
|
|
|
|
|
|
|
+ if (afterFetch && isFunction(afterFetch)) {
|
|
|
|
+ item.responseData = (await afterFetch(data)) || data;
|
|
|
|
+ }
|
|
|
|
+
|
|
return {
|
|
return {
|
|
success: true,
|
|
success: true,
|
|
error: null,
|
|
error: null,
|
|
@@ -227,7 +231,6 @@
|
|
return uploadApiByItem(item);
|
|
return uploadApiByItem(item);
|
|
}),
|
|
}),
|
|
);
|
|
);
|
|
- debugger;
|
|
|
|
|
|
|
|
isUploadingRef.value = false;
|
|
isUploadingRef.value = false;
|
|
// 生产环境:抛出错误
|
|
// 生产环境:抛出错误
|