From 4c96ddf666ecb54eb42edcbb4636e59c1fdf9714 Mon Sep 17 00:00:00 2001 From: xcy_life <104405525+ziyi99@users.noreply.github.com> Date: Tue, 31 Oct 2023 11:33:44 +0800 Subject: [PATCH] =?UTF-8?q?fix(upload):=20=E4=BF=AE=E5=A4=8D=E6=8B=96?= =?UTF-8?q?=E6=8B=BD=E7=9A=84=E6=96=87=E4=BB=B6=E4=B8=8D=E7=AC=A6=E5=90=88?= =?UTF-8?q?accept=E9=85=8D=E7=BD=AE=E6=97=B6=EF=BC=8C=E6=8B=96=E6=8B=BD?= =?UTF-8?q?=E7=BB=93=E6=9D=9F=E5=90=8E=E4=B8=8D=E4=BC=9A=E8=A7=A6=E5=8F=91?= =?UTF-8?q?Drop=E4=BA=8B=E4=BB=B6=E7=9A=84=E9=97=AE=E9=A2=98=20(#3532)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(upload): 拖拽不符合accept配置的文件时,拖拽结束时支持触发onDrop事件 * fix(upload): 优化uploadDrag拖拽结束判断 --------- Co-authored-by: 向长永 --- src/upload/hooks/useDrag.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/upload/hooks/useDrag.ts b/src/upload/hooks/useDrag.ts index da06387955..69806367e6 100644 --- a/src/upload/hooks/useDrag.ts +++ b/src/upload/hooks/useDrag.ts @@ -19,10 +19,10 @@ export default function useDrag(props: UploadDragEvents, accept: Ref) { const { files } = event.dataTransfer; const dragFiles: File[] = getFileList(files, accept.value); - if (!dragFiles.length) return; - - props.onDragFileChange?.(dragFiles); props.onDrop?.({ e: event }); + if (dragFiles?.length) { + props.onDragFileChange?.(dragFiles); + } }; const handleDragenter = (event: DragEvent) => {