JSFiddle - React, Tailwind, and code Playground
HTML
<div id="todoapp">
<div id="todo">
<h4>Todo</h4>
<table>
<thead>
<tr>
<th>Tasks</th>
<th>Edit</th>
<th>Options</th>
</tr>
</thead>
<tbody>
<tr v-repeat="task: tasks">
<td>{{ task.body }}</td>
<td>
<div>
<input v-el="editInputField" type="text" value="{{ task.body }}" v-on="keyup: doneEdit(this) | key 'enter'"/>
</div>
</td>
<td>
<button v-on="click: editTask(this)">
Edit
</button>
</td>
</tr>
</tbody>
</table>
</div> <pre>
{{ $data | json }}
</pre>
</div>
JavaScript
new Vue({
el: '#todoapp',
data: {
tasks: [{
'body': 'Eat breakfast',
'completed': false
}, {
'body': 'Drink milk',
'completed': false
}, {
'body': 'Go to the store',
'completed': false
}],
newTask: '',
},
methods: {
editTask: function (task) {
var taskIndex = this.tasks.indexOf(task.task);
this.tasks[taskIndex] = {
'body': document.querySelector('input').value,
'completed': false
};
console.log(task.task.body);
},
}
});