diff options
| author | Leonardo Bishop <me@leonardobishop.com> | 2024-10-26 12:10:47 +0100 |
|---|---|---|
| committer | Leonardo Bishop <me@leonardobishop.com> | 2024-10-26 12:10:47 +0100 |
| commit | 5e4d41d1dfeaaeca731b3c5496377214ec6e557f (patch) | |
| tree | 6b1c5359f17e1e30c85fdb7d611d1c5bbb7843e9 /src/stores/counter.ts | |
bootstrap project
Diffstat (limited to 'src/stores/counter.ts')
| -rw-r--r-- | src/stores/counter.ts | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/stores/counter.ts b/src/stores/counter.ts new file mode 100644 index 0000000..b6757ba --- /dev/null +++ b/src/stores/counter.ts @@ -0,0 +1,12 @@ +import { ref, computed } from 'vue' +import { defineStore } from 'pinia' + +export const useCounterStore = defineStore('counter', () => { + const count = ref(0) + const doubleCount = computed(() => count.value * 2) + function increment() { + count.value++ + } + + return { count, doubleCount, increment } +}) |
