跳板机管理web端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
685 B

9 years ago
  1. <template>
  2. <div>
  3. <h1>vuex 测试</h1>
  4. Clicked: {{ getCount }} times
  5. <button @click="increment">+</button>
  6. <button @click="decrement">-</button>
  7. </div>
  8. </template>
  9. <script>
  10. import { mapGetters } from 'vuex'
  11. import { mapActions } from 'vuex'
  12. export default {
  13. computed: {
  14. // 使用对象展开运算符将 getters 混入 computed 对象中
  15. ...mapGetters([
  16. 'getCount'
  17. // ...
  18. ])
  19. },
  20. methods: {
  21. ...mapActions([
  22. 'increment', // 映射 this.increment() 为 this.$store.dispatch('increment')
  23. 'decrement'
  24. ])
  25. //...mapActions({
  26. // add: 'increment' // 映射 this.add() 为 this.$store.dispatch('increment')
  27. //})
  28. }
  29. }
  30. </script>