0

is there any good reason to add the char '$' to parameter name of a method ? is different <childComponent @updateMissionPriority="updateMissionPriority($event)" /> compared to <childComponent @updateMissionPriority="updateMissionPriority(param)" /> ?

  • 1
    There's nothing special about `$` in variable names. However, `$event` is a built-in variable in Vue.js, `param` isn't. – Barmar Jul 25 '23 at 00:15
  • There is no reason at all to prefix a method param name with `$`. But there is a [very good reason](https://vuejs.org/guide/essentials/event-handling.html#accessing-event-argument-in-inline-handlers) to pass `$event` to a native handler. – tao Jul 25 '23 at 00:16
  • @Barmar when should use that built-in variable over other variables ? which cases ? – adila maloul Jul 25 '23 at 00:24
  • @tao but in the given example **updateMissionPriority** is not a native handler – adila maloul Jul 25 '23 at 00:25
  • 1
    Read the documentation to learn what `$event` is used for. – Barmar Jul 25 '23 at 00:26
  • I never said it was. The first part of my previous comment answers your question. The second part is only added for completeness. In your second `` example `param` is `undefined`. – tao Jul 25 '23 at 00:31
  • well I don't understand what is meant by "**need to access the original DOM event**" – adila maloul Jul 25 '23 at 00:42

0 Answers0