ImageUpload
A secondary encapsulation of the element-plus upload component. It simplifies basic image operations.
Basic Usage
INFO
Use the api for asynchronous logic to customize the upload process, then construct the image URL parameter url.
Multiple Image Control
Properties
| Property Name | Description | Type | Extended | Default Value |
|---|---|---|---|---|
| v-model | Image URL | string | Yes | - |
| api | Asynchronous upload method | Function | Yes | - |
| image-types | Image format restrictions | Array | Yes | webp,png,jpg,gif,bmp,jpeg |
| limit-size | Image size limit in MB | number | Yes | 10 |
| style | Custom style | Record | Yes | { width: '100px', height: '100px' } |
| fix | Image fill mode | enum | Yes | contain |
| multiple | Enable multiple image mode | boolean | Yes | false |
| limit | Maximum number of images in multiple mode | number | Yes | 9 |
| action | Request URL | string | No | "" |
| disabled | Disable the upload | boolean | No | false |
| on-success | Hook triggered on successful upload | Function | No | - |
| on-error | Hook triggered on upload failure | Function | No | - |
| on-progress | Hook triggered during file upload | Function | No | - |
| on-change | Hook triggered when file status changes | Function | No | - |
Events
| Event Name | Description | Type | Extended |
|---|---|---|---|
| update:model-value | Triggered when the bound value changes | Function | No |
Methods
| Method Name | Description | Parameters | Return Value |
|---|---|---|---|
| getUploadRef | Get upload component reference | - | ElUpload instance |
| getUrlList | Get parsed image URL list | - | string[] |