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++
| },
| }
| })
|
|