Skip to content

Commit

Permalink
feat: upload support result field
Browse files Browse the repository at this point in the history
  • Loading branch information
suyuan32 committed Aug 14, 2024
1 parent beaf0f0 commit add2fba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/Upload/src/components/UploadModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
import { buildUUID } from '@/utils/uuid';
import { isFunction } from 'remeda';
import { warn } from '@/utils/log';
import { get } from '@/utils/object';
import FileList from './FileList.vue';
import { useI18n } from '@/hooks/web/useI18n';
import file2md5 from 'file2md5';
Expand Down Expand Up @@ -305,7 +306,7 @@
for (const item of fileListRef.value) {
const { status, responseData } = item;
if (status === UploadResultStatus.SUCCESS && responseData) {
fileList.push(responseData.data.url);
fileList.push(get(responseData, props.resultField));
}
}
// 存在一个上传成功的即可保存
Expand Down
6 changes: 6 additions & 0 deletions src/components/Upload/src/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ export const basicProps = {
type: Object as PropType<SortableOptions>,
default: () => ({}),
},

resultField: {
type: String as PropType<string>,
default: 'data.url',
},

calculateMd5: {
type: Boolean as PropType<boolean>,
default: false,
Expand Down

0 comments on commit add2fba

Please sign in to comment.