File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change 1
1
<template >
2
- <div class =" flex items-center justify-center w-full"
2
+ <form class =" flex items-center justify-center w-full"
3
3
@dragover.prevent =" dragging = true"
4
4
@dragleave.prevent =" dragging = false"
5
5
@drop.prevent =" dragging = false; doEmit($event.dataTransfer.files)"
43
43
:multiple =" props.multiple || false"
44
44
/>
45
45
</label >
46
- </ div >
46
+ </ form >
47
47
</template >
48
48
49
49
<script setup lang="ts">
50
50
import { humanifySize } from ' @/utils' ;
51
- import { ref , type Ref } from ' vue' ;
51
+ import { ref , defineExpose , type Ref } from ' vue' ;
52
52
import { IconFileSolid } from ' @iconify-prerendered/vue-flowbite' ;
53
53
import { watch } from ' vue' ;
54
54
import adminforth from ' @/adminforth' ;
@@ -125,4 +125,14 @@ function doEmit(filesIn: FileList) {
125
125
126
126
const dragging = ref (false );
127
127
128
+ function clear() {
129
+ selectedFiles .value = [];
130
+ emit (' update:modelValue' , []);
131
+ const form = document .getElementById (id )?.closest (' form' );
132
+ form ?.reset ();
133
+ }
134
+
135
+ defineExpose ({
136
+ clear ,
137
+ });
128
138
</script >
You can’t perform that action at this time.
0 commit comments