mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-14 10:04:05 +00:00
33 lines
542 B
Vue
33 lines
542 B
Vue
<template>
|
|
<div>
|
|
<p>
|
|
<button @click="increment">
|
|
{{ counter }}
|
|
</button><br>
|
|
<NuxtLink to="/about">
|
|
About
|
|
</NuxtLink>
|
|
</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: {
|
|
increment() {
|
|
this.$store.commit('increment')
|
|
}
|
|
}
|
|
}
|
|
</script>
|