Upload
# FxUpload Upload
Upload files by clicking or dragging
# Click to Upload
Only jpg/png files can be uploaded, and no more than 10000kb
Copy
# Avatar Upload
Use before-upload to limit the image format and size uploaded by users.
Only image files can be uploaded, and no more than 20kb
Copy
# Photo Wall
Use the list-type attribute to set the style of the file list.
Copy
# File Thumbnail
Use scoped-slot to set the thumbnail template.
Copy
# Image List Thumbnail
Only jpg/png files can be uploaded, and no more than 500kb
Copy
# Upload File List Control
Control the list through the on-change hook function
Only jpg/png files can be uploaded, and no more than 500kb
Copy
# Drag to Upload
Drag file here, or click to upload
Only jpg/png files can be uploaded, and no more than 500kb
Copy
# Manual Upload
Only jpg/png files can be uploaded, and no more than 500kb
Copy
# Chunk Upload
Only jpg/png files can be uploaded, and no more than 500kb
Copy
Attributes
| Attribute | Description | Type | Options | Default |
|---|---|---|---|---|
| url | File upload address (non-chunk) | string | — | "/FSC/EM/File/UploadByForm" |
| headers | Set the request headers for upload | object | — | — |
| multiple | Whether to support multiple file selection | boolean | — | — |
| data | Additional parameters attached when uploading | object | — | — |
| name | Field name of the uploaded file | string | — | file |
| with-credentials | Support sending cookie credential information | boolean | — | false |
| show-file-list | Whether to display the uploaded file list | boolean | — | true |
| drag | Whether to enable drag and drop upload | boolean | — | false |
| accept | Accepted file types for upload (this parameter is invalid in thumbnail-mode), multiple types separated by commas | string | .txt,.pdf,.jpg | — |
| on-preview | Hook function when clicking on uploaded files in the file list | function(file) | — | — |
| on-remove | Hook function when removing files from the file list | function(file, fileList) | — | — |
| on-success | Hook function when file upload succeeds | function(response, file, fileList) | — | — |
| on-error | Hook function when file upload fails | function(err, file, fileList) | — | — |
| on-progress | Hook function during file upload | function(event, file, fileList) | — | — |
| on-change | Hook function when file status changes, called when adding files, upload succeeds, and upload fails | function(file, fileList) | — | — |
| on-exceed | Hook function when files exceed the limit | function(files,
fileList,o) files: newly selected files o.type: 1: number of files exceeds limit (limit must be set), 2: file size exceeds limit (maxSize must be set) 3: file type does not match (accept must be set) | — | — |
| before-upload | Hook function before uploading files, parameter is the file to be uploaded. If false is returned, upload will be stopped. | function(files) | — | — |
| before-remove | Hook function before removing files, parameters are the file to be removed and the file list. If false is returned or a Promise is returned and rejected, removal will be stopped. | function(file, fileList) | — | — |
| list-type | Type of file list | string | text/picture/picture-card | text |
| auto-upload | Whether to upload immediately after selecting files | boolean | — | true |
| file-list | List of uploaded files, e.g.: [{name: 'food.jpg', url: 'https://xxx.cdn.com/xxx.jpg'}] | array | — | [] |
| http-request | Override the default upload behavior, can customize the upload implementation | function(options) | — | — |
| disabled | Whether to disable | boolean | — | false |
| limit | Maximum number of files allowed to upload | number | — | — |
| max-size | Maximum upload size allowed (KB), default 10M | number | — | 10485760 |
| basePath | Root address of upload interface | string | — | — |
| whenChunks | When file size exceeds this value, chunk upload will be used, default 0: no chunking, unit B | number | — | 0 |
| chunk | Chunk information, see chunk table below | object | — | — |
chunk
| Attribute | Description | Type | Options | Default |
|---|---|---|---|---|
| mime | Value of Content-Type in the request | string | — | — |
| size | Chunk size, unit B | number | — | 2097152 |
| tryTime | Number of retries on failure | number | — | 3 |
| starturl | Upload preprocessing interface | string | — | "/FSC/EM/File/ChunkFileUploadStart" |
| uploadurl | Chunk upload interface | string | — | "/FSC/EM/File/ChunkFileUploadDataByStream" |
| doneurl | Post-upload processing interface | string | — | "/FSC/EM/File/ChunkFileUploadComplete" |
Slot
| Name | Description |
|---|---|
| trigger | Content that triggers the file selection box |
| tip | Tip text |
Methods
| Method | Description | Parameters |
|---|---|---|
| clearFiles | Clear the uploaded file list (this method cannot be called in before-upload) | — |
| getFiles | Get the uploaded file list | — |
| abort | Cancel upload request | ( file: file object in fileList ) |
| uploadFile | Manually upload file(s), can be used for re-upload | file |