file input @change do not trigger function again #6440
-
Hey all, Maybe such a simple thing, but I do not know a solution. 🙈 Is it possible to "reset" an input with type file or do you know another vue directive which would work better? Thanks a lot! 😃 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You can use this code <script setup>
import { ref } from 'vue'
const file = ref()
/* reset */
function reset() {
file.value.value = ''
}
function foo(event) {
console.log(event.target.files)
}
</script>
<template>
<input ref="file" type="file" @change="foo($event)" @click="reset">
</template> Hope this can help you. |
Beta Was this translation helpful? Give feedback.
You can use this code
Playground
Hope this can help you.