file input @change do not trigger function again #6440
Answered
by
liulinboyi
geyermichael
asked this question in
Help/Questions
-
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.
Answered by
liulinboyi
Aug 11, 2022
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.
1 reply
Answer selected by
geyermichael
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can use this code
Playground
Hope this can help you.