项目创建

This commit is contained in:
浅念
2025-07-04 17:16:38 +08:00
parent ce47b39fa5
commit 719911918f
372 changed files with 105035 additions and 32 deletions
+28
View File
@@ -0,0 +1,28 @@
import type { App } from 'vue'
import { createPinia } from 'pinia'
import { createPersistedState } from 'pinia-plugin-persistedstate'
import { StorageKeyManager } from '@/utils/storage/storage-key-manager'
export const store = createPinia()
// 创建存储键管理器实例
const storageKeyManager = new StorageKeyManager()
// 配置持久化插件
store.use(
createPersistedState({
key: (storeId: string) => storageKeyManager.getStorageKey(storeId),
storage: localStorage,
serializer: {
serialize: JSON.stringify,
deserialize: JSON.parse
}
})
)
/**
* 初始化 Store
*/
export function initStore(app: App<Element>): void {
app.use(store)
}