mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
Update examples
This commit is contained in:
parent
18c694d5ce
commit
f8de9dbe0d
@ -10,7 +10,7 @@ export default {
|
||||
layout: 'dark',
|
||||
data ({ req }) {
|
||||
return {
|
||||
name: req ? 'server' : 'client2'
|
||||
name: req ? 'server' : 'client'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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')
|
||||
},
|
||||
|
@ -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>
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user