add pinia

This commit is contained in:
dt
2023-09-16 11:07:32 +08:00
parent 42618602f4
commit fce56e43c3
5 changed files with 215 additions and 90 deletions

View File

@@ -0,0 +1,19 @@
import { defineStore } from 'pinia';
export const useCounterStore = defineStore('counter', {
state: () => ({
counter: 0
}),
getters: {
doubleCount (state) {
return state.counter * 2;
}
},
actions: {
increment () {
this.counter++;
}
}
});