index.ts 596 B

123456789101112131415161718192021
  1. import { createPinia, setActivePinia } from 'pinia'
  2. import { createPersistedState } from 'pinia-plugin-persistedstate' // 数据持久化
  3. const store = createPinia()
  4. store.use(
  5. createPersistedState({
  6. storage: {
  7. getItem: uni.getStorageSync,
  8. setItem: uni.setStorageSync,
  9. },
  10. }),
  11. )
  12. // 立即激活 Pinia 实例, 这样即使在 app.use(store)之前调用 store 也能正常工作 (解决APP端白屏问题)
  13. setActivePinia(store)
  14. export default store
  15. export * from './loading'
  16. // 模块统一导出
  17. export * from './token'
  18. export * from './user'