2016-11-07 19:57:44 +00:00
|
|
|
<template>
|
|
|
|
<div>
|
2019-02-19 09:35:51 +00:00
|
|
|
<h3>Index Module</h3>
|
|
|
|
<button @click="increment">
|
|
|
|
{{ counter }}
|
|
|
|
</button>
|
|
|
|
<br>
|
|
|
|
<NuxtLink to="/about">
|
|
|
|
About
|
|
|
|
</NuxtLink>
|
|
|
|
<br>
|
|
|
|
<br>
|
|
|
|
<h3>Todo Module</h3>
|
|
|
|
<NuxtLink to="/todos">
|
|
|
|
Todos
|
|
|
|
</NuxtLink>
|
|
|
|
<br>
|
|
|
|
<br>
|
|
|
|
<h3>Nested Modules</h3>
|
|
|
|
<NuxtLink to="/website">
|
|
|
|
Website
|
|
|
|
</NuxtLink>
|
2016-11-07 19:57:44 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { mapState } from 'vuex'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
// fetch(context) is called by the server-side
|
2019-02-19 09:35:51 +00:00
|
|
|
// and before instantiating the component
|
2019-07-10 10:45:49 +00:00
|
|
|
fetch ({ store }) {
|
2016-11-07 19:57:44 +00:00
|
|
|
store.commit('increment')
|
|
|
|
},
|
2019-11-26 22:42:39 +00:00
|
|
|
computed: mapState([
|
|
|
|
'counter'
|
|
|
|
]),
|
2016-11-07 19:57:44 +00:00
|
|
|
methods: {
|
2019-07-10 10:45:49 +00:00
|
|
|
increment () {
|
2017-08-13 20:11:51 +00:00
|
|
|
this.$store.commit('increment')
|
|
|
|
}
|
2016-11-07 19:57:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|