Hacker News new | past | comments | ask | show | jobs | submit login

Why would you ever have the logic in methods in Vue? Just keep it simple

<button @click="count--"> <button @click="count++">




Because templates should be declarative.

Error checking code becomes much more difficult because of the ambiguity and special parsing that has to be done. Its not just the loader, but things like the ide extensions used.

Allowing small bits of logic like this makes for very nice one-liners and demos, but in the long term its well worth it to make the template as declarative as possible - ideally just a method name.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: