3 ms·
Why would you ever have the logic in methods in Vue? Just keep it simple <button @click="count--"> <button @click="count++">
by martini333 6y ago
Why would you ever have the logic in methods in Vue? Just keep it simple
<button @click="count--">
<button @click="count++">
- preommr 6y agoBecause 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.