drawing-back/src/stores/counter.ts
zhangzhichao02 1189e9c716 v1.0.0
2024-01-08 11:56:23 +08:00

15 lines
318 B
TypeScript

// stores/counter.ts
import { defineStore } from 'pinia';
export const useCounterStore = defineStore('counter', {
state: () => {
return { count: 0 };
},
// 也可以这样定义
// state: () => ({ count: 0 })
actions: {
increment() {
this.count++;
},
},
});