1๐
That declaration is triggered by your template, where you are binding change
event to the method. The whole event as parameter gets passed to the method, Refer this section of Vue docs
for better information https://v2.vuejs.org/v2/guide/events.html#Method-Event-Handlers
1๐
When a variable is called e
it is usually the event. You can always console.log(e)
and read its properties in the browser console.
But according to this example e
is the file that is uploaded:
methods: {
thumbUrl (file) {
return file.myThumbUrlProperty
},
onFileChange (file) {
// Handle files like:
this.fileUploaded = file
}
}
1๐
onFileChange(e)
has e
as event
related to the dom. Since while assigning the function in html
if there is no parameter passed, the event
as a parameter is automatically passed by javaScript.
0๐
The declaration onFileChange(e) {
declares a function with the name onFileChange
that takes a single parameter e
. That is what introduces the variable into the function body.