You are viewing a single comment's thread from:

RE: Learning Vue.js - A Task List

in #javascript6 years ago (edited)

Great work! Here's another way to eliminate the method but keep the button and click binding:

<button @click="task.completed = !task.completed">Toggle</button>

Here's the fiddle:

https://jsfiddle.net/harps116/2hmu4yyh/2/

This technique is pretty handy for toggle scenarios. Of course you could abstract the logic into a method for reuse and have a global toggle utility method which might be useful.

Sort:  

Thank you. I think that this "demo app" idea of a Task List or Todo List is a good way to learn. I think I will create one for myself with a database backend as a way to learn how to put everything together.

Coin Marketplace

STEEM 0.27
TRX 0.11
JST 0.031
BTC 67804.05
USDT 1.00
SBD 3.72