mirror of
https://github.com/ElemeFE/element.git
synced 2025-12-16 11:44:01 +08:00
Upload: fix Error when beforeUpload hook return promise of file object (#11297)
* Upload: fix beforeUpload hook bug * Upload: add ElUploadInternalRawFile interface
This commit is contained in:
8
types/upload.d.ts
vendored
8
types/upload.d.ts
vendored
@@ -9,13 +9,17 @@ export interface FileListItem {
|
||||
status?: FileUploadStatus
|
||||
}
|
||||
|
||||
export interface ElUploadInternalRawFile extends File {
|
||||
uid: number
|
||||
}
|
||||
|
||||
export interface ElUploadInternalFileDetail {
|
||||
status: FileUploadStatus,
|
||||
name: string,
|
||||
size: number,
|
||||
percentage: number,
|
||||
uid: number,
|
||||
raw: File,
|
||||
raw: ElUploadInternalRawFile,
|
||||
url?: string
|
||||
}
|
||||
|
||||
@@ -83,7 +87,7 @@ export declare class ElUpload extends ElementUIComponent {
|
||||
onChange: (file: ElUploadInternalFileDetail, fileList: ElUploadInternalFileDetail[]) => void
|
||||
|
||||
/** Hook function before uploading with the file to be uploaded as its parameter. If false or a Promise is returned, uploading will be aborted */
|
||||
beforeUpload: (file: ElUploadInternalFileDetail) => boolean | Promise<File | boolean>
|
||||
beforeUpload: (file: ElUploadInternalRawFile) => boolean | Promise<File | Blob | boolean>
|
||||
|
||||
/** Whether thumbnail is displayed */
|
||||
thumbnailMode: boolean
|
||||
|
||||
Reference in New Issue
Block a user