Mr.Shi
2023-08-22 1e34d0773506d542ddcf914cdcaa94708167d89b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import { computed } from 'vue';
import { defineStore } from 'pinia';
 
export const useCounterStore = defineStore('enterprise', {
  state: () => {
    return { count: 0 }
  },
  // 也可以定义为
  // state: () => ({ count: 0 })
  actions: {
    increment() {
      this.count++
    },
  }
})