File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11<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"
34 @dragover.prevent =" dragging = true"
45 @dragleave.prevent =" dragging = false"
56 @drop.prevent =" dragging = false; doEmit($event.dataTransfer.files)"
4344 :multiple =" props.multiple || false"
4445 />
4546 </label >
46- </ div >
47+ </ form >
4748</template >
4849
4950<script setup lang="ts">
5051import { humanifySize } from ' @/utils' ;
51- import { ref , type Ref } from ' vue' ;
52+ import { ref , defineExpose , type Ref } from ' vue' ;
5253import { IconFileSolid } from ' @iconify-prerendered/vue-flowbite' ;
5354import { watch } from ' vue' ;
5455import adminforth from ' @/adminforth' ;
@@ -125,4 +126,14 @@ function doEmit(filesIn: FileList) {
125126
126127const dragging = ref (false );
127128
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+ });
128139 </script >
You can’t perform that action at this time.
0 commit comments