Skip to content
Advertisement

sending extra argument to event handler with event argument

i have this input with onchange event handler

JavaScript

my imageChange method is like

JavaScript

basically setting model.image value on change now i want to have multiple images on my model … so i want to change the image property to array and have an input for each image

JavaScript

now i need to send the imaeg index in the array to my function as well so i can replace that index image like

and change my method to

JavaScript

but this will result in undefined event here is the output

JavaScript

how can i send extra argument to event handler without losing event argument ?

Advertisement

Answer

Just execute the function inside with @change event, and pass the Vue provided $event params first then index param.

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement