mirror of
https://github.com/nuxt/nuxt.git
synced 2024-12-04 19:37:18 +00:00
cf24b926a1
- Add example /custom-routes/ - Rename example/with-store/ to examples/vuex-store/ - Feature: Add .vue at the end of the component if not specified in custom routes - Feature: Add .params and .query in the context - Feature: Add .name in route if given in custom routes
27 lines
508 B
Vue
27 lines
508 B
Vue
<template>
|
|
<div>
|
|
<p>
|
|
<button @click="increment">{{ counter }}</button><br>
|
|
<router-link to="/about">About</router-link>
|
|
</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>
|