prazdevs / pinia-plugin-persistedstate

💾 Configurable persistence and rehydration of Pinia stores.
https://prazdevs.github.io/pinia-plugin-persistedstate/
MIT License
2.09k stars 120 forks source link

如何在代码中动态指定持久化到哪个storage中? #234

Closed cavellpotter closed 10 months ago

cavellpotter commented 1 year ago

Describe the bug

如何在代码中动态指定持久化到哪个storage中?

Reproduction

11

System Info

11

Used Package Manager

pnpm

Validations

prazdevs commented 1 year ago

As it is, I do not see a proper solution that would work all the time. Maybe doable with a custom storage ?

MZ-Dlovely commented 1 year ago

As it is, I do not see a proper solution that would work all the time. Maybe doable with a custom storage ?

maybe we can try to receive a reactify variable to achieve dynamic settings.

prazdevs commented 10 months ago

As for now this cannot be achieved in a "clean" way, maybe this can be considered for an eventual v4, but that would require running a function to return the storage everytime the persistence is called, and giving access to lots of things from this function.

Closing this for now but i'll consider it if v4 ever sees the light 🙏