I am trying to create an upload image vue component. I am getting multiple errors from webstorm and Ive tried copying and pasting similar code with the same error. I also get the error on using .click() . The error on hover states "Property files doesnt exist on type unknown"
CodePudding user response:
use it like this:
const fileInput = this.$refs.fileInput1 as HTMLInputElement
if (fileInput?.files && fileInput.files[0]){
formData.append('image_main', fileInput.files[0])
}