feat(pinia): 添加 pinia 并做数据持久化

This commit is contained in:
BTMuli
2023-03-05 17:45:15 +08:00
parent 1306c6fd4e
commit 8d6f9e13f9
4 changed files with 70 additions and 1 deletions

View File

@@ -2,5 +2,7 @@ import { createApp } from "vue";
import App from "./App.vue";
// 路由
import router from "./router";
// Pinia
import { pinia } from "./store";
createApp(App).use(router).mount("#app");
createApp(App).use(router).use(pinia).mount("#app");

8
src/store/index.ts Normal file
View File

@@ -0,0 +1,8 @@
import { createPinia } from "pinia";
import { createPersistedState } from "pinia-plugin-persistedstate";
const pinia = createPinia();
pinia.use(createPersistedState());
export { pinia };