robinvdvleuten / vuex-persistedstate

💾 Persist and rehydrate your Vuex state between page reloads.
https://npm.im/vuex-persistedstate
MIT License
5.76k stars 375 forks source link

Example needed: path options and namespaces #428

Open vicenterusso opened 2 years ago

vicenterusso commented 2 years ago

How can I use the key and path options with multiple namespaces?

Harm-Nullix commented 2 years ago

Make more createPersistedState objects? The key is purely for you localstorage index, so if you want more of that, you shouldmake more objects.

If you want more paths, in my app I have a namespace called tabs where in that state, there lives a couple of objects and of that objects, I only want to save one: list, so when I want to include that namespace, I use paths: ['tabs.list']. My guess to put more namespaces in one storage object is using things like:

paths: ['tabs.list', 'colors', 'myTacoNamespace`]