18 lines
305 B
TypeScript
18 lines
305 B
TypeScript
import { defineStore } from "pinia";
|
|
|
|
export const useCounterStore = defineStore("counter", {
|
|
state: () => ({
|
|
count: 0,
|
|
}),
|
|
getters: {
|
|
doubleCount: (state) => state.count * 2,
|
|
},
|
|
actions: {
|
|
increment() {
|
|
this.count += 1;
|
|
},
|
|
},
|
|
persist: {
|
|
paths: ["count"],
|
|
},
|
|
});
|