2016-11-07 19:57:44 +00:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<p>
|
2018-11-24 18:49:19 +00:00
|
|
|
<button @click="increment">
|
|
|
|
{{ counter }}
|
|
|
|
</button><br>
|
|
|
|
<NuxtLink to="/about">
|
|
|
|
About
|
|
|
|
</NuxtLink>
|
2016-11-07 19:57:44 +00:00
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { mapState } from 'vuex'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
// fetch(context) is called by the server-side
|
|
|
|
// and nuxt before instantiating the component
|
2017-10-31 13:43:55 +00:00
|
|
|
fetch({ store }) {
|
2016-11-07 19:57:44 +00:00
|
|
|
store.commit('increment')
|
|
|
|
},
|
|
|
|
computed: mapState([
|
|
|
|
'counter'
|
|
|
|
]),
|
|
|
|
methods: {
|
2017-10-31 13:43:55 +00:00
|
|
|
increment() {
|
2017-08-13 20:11:51 +00:00
|
|
|
this.$store.commit('increment')
|
|
|
|
}
|
2016-11-07 19:57:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|