pinia.ts 380 B

12345678910111213141516
  1. import type { Plugin } from 'vue'
  2. import { createPinia } from 'pinia'
  3. import { createPersistedState } from 'pinia-plugin-persistedstate'
  4. export default {
  5. install(app, options) {
  6. const pinia = createPinia()
  7. pinia.use(
  8. createPersistedState({
  9. key: (id) => `__${id}__`,
  10. storage: localStorage
  11. })
  12. )
  13. app.use(pinia, options)
  14. }
  15. } as Plugin