3 ms·
I am also glad to see the new way to define event handlers. The v 2 way of defining a “methods” prototype forces me to constantly reference “this” (which will
by Roboprog 7y ago
I am also glad to see the new way to define event handlers. The v 2 way of defining a “methods” prototype forces me to constantly reference “this” (which will only exist later after the component has “really” been created), which I would prefer to avoid.
At least in AngularJS I can capture “this” as a closure variable at the start of the component setup “decorator” function, then alias other functions delegated as the component “methods” (event handlers) without worrying about object instance references for “apply” and such.
Now, I can so something similar in Vue components: get the data up front in the event handlers definitions, and delegate to any functions I want using closures or partially applied arguments.
Hard to understate the importance of the new event handler setup API.