#What is the DOM event emitted when an input that is type="file" does a change?

2 messages · Page 1 of 1 (latest)

native prism
#

I'm using Vue and have the following (though it should not matter for my question)

<input :id="computedId" type="file" @change="a($event)" />
const a = (b: Event) => {
  modelValue.value = b.target?.files
}

However, this throws Property 'files' does not exist on type 'EventTarget'.. I assume the Event is the wrong type for this. What is the real event?

#

I don't think there's a specific event class for this. So instead I did

    <input
      :id="computedId"
      ref="input"
      :multiple="multipleBoolean"
      class="form-control"
      type="file"
      @change="a"
    />
const input = ref<HTMLInputElement | null>(null)
const a = () => {
  modelValue.value = input.value?.files
}