In the Vue documentation, the syntax myFunc: function(){...}
is often used, for computed
or methods
. In these places, myFunc(){...}
also works. Is there any difference? Is there any reason not to use the simpler syntax?
Asked
Active
Viewed 295 times
1

bbsimonbb
- 27,056
- 15
- 80
- 110
1 Answers
0
The both do the same thing. The difference is the shorter one is ES6 syntax which needs to be transpiled into ES5 in order to work in older browsers.

Scriptonomy
- 3,975
- 1
- 15
- 23