Home > Net >  How to reset a v-input-file with vuetify?
How to reset a v-input-file with vuetify?

Time:03-23

I'm trying to reset my v-input-file when i click on a button. But, i don't see any function to do that. I tried the following commands : (upload_json is the name of my v-input-file)

this.$refs.upload_json.files=[]
this.$refs.upload_json.files=null
this.$refs.upload_json.value=""
this.$refs.upload_json.reset()

For all the commands, I had the same following error :

Uncaught TypeError: proxy set handler returned false for property

CodePudding user response:

you can use this.$refs.upload_json.value=null

CodePudding user response:

You can clear input this way:

this.$refs.upload_json.internalValue = this.multiple ? [] : null

I tested it and it works. If you look at the source of the v-file component, that is how Vuetify developers clear the input when you click on the clear icon.

  • Related