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