Home.vue 599 B

1234567891011121314151617181920212223242526272829
  1. <template>
  2. <div>
  3. Home page
  4. <div>
  5. <v-btn @click="decrement()">Decrement</v-btn>
  6. <v-btn @click="$store.commit('increment', -count)">Reset</v-btn>
  7. <v-btn @click="increment()">Increment</v-btn>
  8. </div>
  9. <div>
  10. {{ count }}
  11. </div>
  12. Count should stay in the same state if you reload the page/close your browser.
  13. </div>
  14. </template>
  15. <script>
  16. import { mapActions, mapState } from 'vuex'
  17. export default {
  18. name: 'Home',
  19. components: {},
  20. computed: {
  21. ...mapState(['count'])
  22. },
  23. methods: {
  24. ...mapActions(['increment', 'decrement'])
  25. }
  26. }
  27. </script>