Skip to content
Permalink
Browse files
todo-edit機能追加/それに伴いtodoにediting属性を追加
  • Loading branch information
sin-tanaka committed Sep 25, 2017
1 parent 03619d9 commit 38cf6a941c74708080befe03b48618af7a0d9100
Showing 1 changed file with 10 additions and 6 deletions.
@@ -9,7 +9,10 @@
<div class="task-list">
<label class="task-list__item"
v-for="todo in todos">
<input type="checkbox" v-model="todo.done"><button>EDIT</button>{{ todo.text }}
<input type="checkbox" v-model="todo.done">
<input type="checkbox" v-model="todo.editing">
<input v-if="todo.editing" v-model="todo.text" @keyup.enter="todo.editing = !todo.editing">
<span v-else>{{ todo.text }}</span>
</label>
</div>
</div>
@@ -22,10 +25,10 @@ export default {
return {
msg: 'Welcome to Your Vue.js App',
todos : [
{text : 'vue-router', done: false},
{text : 'vuex', done: false},
{text : 'vue-loader', done: false},
{text : 'awesome-vue', done: true},
{text : 'vue-router', done: false, editing: false},
{text : 'vuex', done: false, editing: false},
{text : 'vue-loader', done: false, editing: false},
{text : 'awesome-vue', done: true, editing: false},
],
newTodo: ""
}
@@ -38,7 +41,8 @@ export default {
}
this.todos.push({
text: text,
done: false
done: false,
editing: false
})
this.newTodo = ''
},

0 comments on commit 38cf6a9

Please sign in to comment.