[Vuejs]-Can I return a function from methods property in Vue and use it as event handler?

0👍

v-on binding can accept either a function or an expression as event handler. A function that an expression evaluates to won’t be used as event handler in this case.

This code just executes someMethodWrapper and ignores a function it returns. It could be workable by explicitly calling it:

@someEvent="someMethodWrapper(data)($event)" 

At this point it doesn’t serve a good purpose to make someMethodWrapper higher order function, it could change signature to fit the case better:

someMethodWrapper(someotherData, data) {...}

and

@someEvent="someMethodWrapper($event, data)" 

Leave a comment