Files
vue-ts-example/src/stores/counter.ts
mini2024 b0cd8b7c61
All checks were successful
/ playwright (push) Successful in 1m27s
/ depcheck (push) Successful in 1m38s
/ build-and-deploy-to-vercel (push) Successful in 2m44s
feat: 添加 eslint-plugin-perfectionist 插件,优化导入排序规则
2025-01-21 23:05:11 +08:00

23 lines
465 B
TypeScript

import { defineStore } from 'pinia';
import { computed, ref } from 'vue';
export const useCounterStore = defineStore(
'counter',
() => {
const count = ref(0);
const doubleCount = computed(() => count.value * 2);
function increment() {
count.value++;
}
return { count, doubleCount, increment };
},
{
persist: true,
},
);
if (import.meta.hot) {
import.meta.hot.accept(acceptHMRUpdate(useCounterStore, import.meta.hot));
}