Skip to content

Commit 40c2e8d

Browse files
committed
fix: 拖拽非文件/文件夹不再显示拖拽提示
1 parent d2d2035 commit 40c2e8d

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

src/components/DropHover.vue

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
<script setup lang="ts">
2-
import { listen } from "@tauri-apps/api/event";
2+
import { listen, Event } from "@tauri-apps/api/event";
33
import { Folder } from "@element-plus/icons-vue";
44
55
let show = $ref(false);
66
7-
listen("tauri://file-drop-hover", () => (show = true));
7+
listen("tauri://file-drop-hover", (event: Event<Array<string>>) => {
8+
if (event.payload.length > 0) show = true;
9+
});
810
listen("tauri://file-drop-cancelled", () => (show = false));
911
listen("tauri://file-drop", () => (show = false));
1012
</script>
1113

1214
<template>
13-
<div class="drop-hover" v-if="show">
15+
<div class="drop-hover" v-if="show" @click="show = false">
1416
<div>
1517
<div>
1618
<el-icon size="3rem">
@@ -32,14 +34,14 @@ listen("tauri://file-drop", () => (show = false));
3234
top: 0;
3335
left: 0;
3436
35-
>div {
37+
> div {
3638
height: 100%;
3739
display: flex;
3840
justify-content: center;
3941
align-items: center;
4042
background-color: var(--el-bg-color);
4143
42-
>div {
44+
> div {
4345
margin: 0 auto;
4446
width: 90vw;
4547
height: 90vh;

0 commit comments

Comments
 (0)