Update examples

This commit is contained in:
Sébastien Chopin 2017-01-09 15:10:01 +01:00
parent 18c694d5ce
commit f8de9dbe0d
4 changed files with 8 additions and 12 deletions

View File

@ -10,7 +10,7 @@ export default {
layout: 'dark',
data ({ req }) {
return {
name: req ? 'server' : 'client2'
name: req ? 'server' : 'client'
}
}
}

View File

@ -15,7 +15,7 @@ import { mapState } from 'vuex'
export default {
// fetch(context) is called by the server-side
// and nuxt before instantiating the component
// and before instantiating the component
fetch ({ store }) {
store.commit('increment')
},

View File

@ -1,12 +1,12 @@
<template>
<div>
<h2>Todos</h2>
<input placeholder="What needs to be done?" @keyup.enter="addTodo">
<ul>
<li v-for="todo in todos">
<input type="checkbox" :checked="todo.done" @change="toggle({ todo })">
<label v-text="todo.text" @dblclick="editing = true"></label>
<input type="checkbox" :checked="todo.done" @change="toggle(todo)">
<span :class="{ done: todo.done }">{{ todo.text }}</span>
</li>
<li><input placeholder="What needs to be done?" @keyup.enter="addTodo"></li>
</ul>
<nuxt-link to="/">Home</nuxt-link>
</div>
@ -35,7 +35,7 @@ export default {
</script>
<style>
li {
list-style: none;
.done {
text-decoration: line-through;
}
</style>

View File

@ -10,11 +10,7 @@ export const mutations = {
})
},
delete (state, { todo }) {
state.list.splice(state.list.indexOf(todo), 1)
},
toggle (state, { todo }) {
toggle (state, todo) {
todo.done = !todo.done
}
}