Skip to content

Commit

Permalink
fix(upload): 修复拖拽的文件不符合accept配置时,拖拽结束后不会触发Drop事件的问题 (#3532)
Browse files Browse the repository at this point in the history
* fix(upload): 拖拽不符合accept配置的文件时,拖拽结束时支持触发onDrop事件

* fix(upload): 优化uploadDrag拖拽结束判断

---------

Co-authored-by: 向长永 <[email protected]>
  • Loading branch information
ziyi99 and 向长永 authored Oct 31, 2023
1 parent 03c6366 commit 4c96ddf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/upload/hooks/useDrag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ export default function useDrag(props: UploadDragEvents, accept: Ref<string>) {

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) => {
Expand Down

0 comments on commit 4c96ddf

Please sign in to comment.