[Vuejs]-Vue:call a function with extra param

0👍

The arguments for your method are coming from the component’s emitted on-success event. For example, it would have something like

this.$emit('on-success', response, file, fileList)

Internally, Vue would do something like (and this is very simplified)…

let boundEventHandler = parseEventHandlerExpression(eventName)
boundEventFunction.apply(vmInstance, arguments)

What you can do in your consumer is capture all these arguments and then append your own

:on-success="handleUrlSuccess(...arguments, 233)"

or

:on-success="(res, file, fileList) => handleUrlSuccess(res, file, fileList, 233)"

Thanks woki for that last one

👤Phil

Leave a comment