Skip to content

file input @change do not trigger function again #6440

Discussion options

You must be logged in to vote

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>

Playground

Hope this can help you.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@geyermichael
Comment options

Answer selected by geyermichael
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants