Laraveldeep's avatar

`input.files` Not Recognized in Single Page Vue Component

Hi,

I am trying to move already tested file upload input field as single file Vue component. I have tested this script already and working fine while used on global scope but when the code is moved to component, I am getting the error.

computed: {
    myMethog: function(event) {
        var input = event.target;
        if(input.files && input.files[0]) {
            // do something here
        }
    }
}

Renderer is throwing this error

[Vue warn]: Error in render: "TypeError: Cannot read property 'files' of undefined"

why?

Same code works when it is not inside component.

0 likes
1 reply

Please or to participate in this conversation.