diff --git a/src/uploader/README.md b/src/uploader/README.md index 8127b6909..f2ef1839d 100644 --- a/src/uploader/README.md +++ b/src/uploader/README.md @@ -322,6 +322,7 @@ export default { | Event | Description | Arguments | | --- | --- | --- | | oversize | Emitted when file size over limit | Same as after-read | +| click-upload `v3.1.5` | Emitted when click upload area | _event: MouseEvent_ | | 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 | diff --git a/src/uploader/README.zh-CN.md b/src/uploader/README.zh-CN.md index 3bb5385b5..1376f8c9f 100644 --- a/src/uploader/README.zh-CN.md +++ b/src/uploader/README.zh-CN.md @@ -340,12 +340,13 @@ export default { ### Events -| 事件名 | 说明 | 回调参数 | -| ------------- | ---------------------- | --------------- | -| oversize | 文件大小超过限制时触发 | 同 `after-read` | -| click-preview | 点击预览图时触发 | 同 `after-read` | -| close-preview | 关闭全屏图片预览时触发 | - | -| delete | 删除文件预览时触发 | 同 `after-read` | +| 事件名 | 说明 | 回调参数 | +| --------------------- | ---------------------- | ------------------- | +| oversize | 文件大小超过限制时触发 | 同 `after-read` | +| click-upload `v3.1.5` | 点击上传区域时触发 | _event: MouseEvent_ | +| click-preview | 点击预览图时触发 | 同 `after-read` | +| close-preview | 关闭全屏图片预览时触发 | - | +| delete | 删除文件预览时触发 | 同 `after-read` | ### Slots diff --git a/src/uploader/Uploader.tsx b/src/uploader/Uploader.tsx index 32a4f8c0e..80e972656 100644 --- a/src/uploader/Uploader.tsx +++ b/src/uploader/Uploader.tsx @@ -109,6 +109,7 @@ export default defineComponent({ emits: [ 'delete', 'oversize', + 'click-upload', 'close-preview', 'click-preview', 'update:modelValue', @@ -307,6 +308,8 @@ export default defineComponent({ } }; + const onClickUpload = (event: MouseEvent) => emit('click-upload', event); + const renderUpload = () => { if (props.modelValue.length >= props.maxCount || !props.showUpload) { return; @@ -327,7 +330,7 @@ export default defineComponent({ if (slots.default) { return ( -