Uploader
Install
Usage
Basic Usage
Preview File
Upload Status
Max Count
Max Size
Custom Upload Area
Preview Cover
Before Read
Disable Uploader
Use disabled
prop to disable uploader.
API
Props
Attribute |
Description |
Type |
Default |
v-model (fileList) |
List of uploaded files |
FileListItem[] |
- |
accept |
Accepted file type |
string |
image/* |
name |
Input name |
number | string |
- |
preview-size |
Size of preview image |
number | string |
80px |
preview-image |
Whether to show image preview |
boolean |
true |
preview-full-image |
Whethe to show full screen image preview when image is clicked |
boolean |
true |
preview-options v2.9.3 |
Options of full screen image preview,see ImagePreview |
object |
- |
multiple |
Whether to enable multiple selection pictures |
boolean |
false |
disabled |
Whether to disabled the upload |
boolean |
false |
deletable |
Whether to show delete icon |
boolean |
true |
show-upload v2.5.6 |
Whether to show upload area |
boolean |
true |
lazy-load v2.6.2 |
Whether to enable lazy load,should register Lazyload component |
boolean |
false |
capture |
Capture,can be set to camera |
string |
- |
after-read |
Hook after reading the file |
Function |
- |
before-read |
Hook before reading the file, return false to stop reading the file, can return Promise |
Function |
- |
before-delete |
Hook before delete the file, return false to stop reading the file, can return Promise |
Function |
- |
max-size |
Max size of file |
number | string |
- |
max-count |
Max count of image |
number | string |
- |
result-type |
Type of file read result, can be set to file text |
string |
dataUrl |
upload-text |
Upload text |
string |
- |
image-fit |
Preview image fit mode |
string |
cover |
upload-icon v2.5.4 |
Upload icon |
string |
photograph |
Events
Event |
Description |
Arguments |
oversize |
Emitted when file size over limit |
Same as after-read |
click-preview |
Emitted when preview image is clicked |
Same as after-read |
close-preview |
Emitted when the full screen image preview is closed |
- |
delete |
Emitted when preview file is deleted |
Same as after-read |
Slots
Name |
Description |
SlotProps |
default |
Custom icon |
- |
preview-cover v2.9.1 |
Custom content that covers the image preview |
item: FileListItem |
Parematers of before-read、after-read、before-delete
Attribute |
Description |
Type |
file |
File object |
object |
detail |
Detail info, contains name and index |
object |
ResultType
Value |
Description |
file |
Result contains File object |
text |
Result contains File object and text content |
dataUrl |
Result contains File object and base64 content |
Methods
Use ref to get Uploader instance and call instance methods.
Name |
Description |
Attribute |
Return value |
closeImagePreview |
Close full screen image preview |
- |
- |
chooseFile v2.5.6 |
Trigger choosing files, works with the user action context only because of browser security |
- |
- |
Less Variables
How to use: Custom Theme.
Name |
Default Value |
Description |
@uploader-size |
80px |
- |
@uploader-icon-size |
24px |
- |
@uploader-icon-color |
@gray-4 |
- |
@uploader-text-color |
@gray-6 |
- |
@uploader-text-font-size |
@font-size-sm |
- |
@uploader-upload-background-color |
@gray-1 |
- |
@uploader-upload-active-color |
@active-color |
- |
@uploader-delete-color |
@white |
- |
@uploader-delete-icon-size |
14px |
- |
@uploader-delete-background-color |
rgba(0, 0, 0, 0.7) |
- |
@uploader-file-background-color |
@background-color |
- |
@uploader-file-icon-size |
20px |
- |
@uploader-file-icon-color |
@gray-7 |
- |
@uploader-file-name-padding |
0 @padding-base |
- |
@uploader-file-name-margin-top |
@padding-xs |
- |
@uploader-file-name-font-size |
@font-size-sm |
- |
@uploader-file-name-text-color |
@gray-7 |
- |
@uploader-mask-background-color |
fade(@gray-8, 88%) |
- |
@uploader-mask-icon-size |
22px |
- |
@uploader-mask-message-font-size |
@font-size-sm |
- |
@uploader-mask-message-line-height |
@line-height-xs |
- |
@uploader-loading-icon-size |
22px |
- |
@uploader-loading-icon-color |
@white |
- |
@uploader-disabled-opacity |
@disabled-opacity |
- |