2016-11-07 19:57:44 +00:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<p>
|
|
|
|
<button @click="increment">{{ counter }}</button><br>
|
2016-12-16 17:12:38 +00:00
|
|
|
<nuxt-link to="/about">About</nuxt-link>
|
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
|
|
|
|
fetch ({ store }) {
|
|
|
|
store.commit('increment')
|
|
|
|
},
|
|
|
|
computed: mapState([
|
|
|
|
'counter'
|
|
|
|
]),
|
|
|
|
methods: {
|
2017-08-13 20:11:51 +00:00
|
|
|
increment () {
|
|
|
|
this.$store.commit('increment')
|
|
|
|
}
|
2016-11-07 19:57:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|