20 lines
285 B
TypeScript
20 lines
285 B
TypeScript
import { defineStore } from 'pinia';
|
|
|
|
export const useCounterStore = defineStore('counter', {
|
|
state: () => ({
|
|
counter: 0
|
|
}),
|
|
|
|
getters: {
|
|
doubleCount (state) {
|
|
return state.counter * 2;
|
|
}
|
|
},
|
|
|
|
actions: {
|
|
increment () {
|
|
this.counter++;
|
|
}
|
|
}
|
|
});
|