feat: 添加 vite-plugin-vue-layouts 插件并更新 vite 版本至 6.0.5

This commit is contained in:
严浩
2024-12-25 00:06:46 +08:00
parent 400de0f222
commit bfbeb326bc
14 changed files with 122 additions and 64 deletions

22
src/stores/counter.ts Normal file
View File

@ -0,0 +1,22 @@
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 };
},
{
persist: true,
},
);
if (import.meta.hot) {
import.meta.hot.accept(acceptHMRUpdate(useCounterStore, import.meta.hot));
}