robinvdvleuten / vuex-persistedstate

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

vuex-persistedstate in nuxtjs didn't work with the indexjs modules #381

Closed ericheshenghao closed 3 years ago

ericheshenghao commented 3 years ago

I have code below as nuxtj plugins

 plugins: [
    { src: '@plugins/persistedState.client.js', ssr: false }
  ],

the details:👇

import createPersistedState from 'vuex-persistedstate'
// 前端数据持久化
export default ({ store }) => {
  window.onNuxtReady(() => {
    createPersistedState({
      key: 'state',

      paths: ['index', 'modules.collection', 'modules.doc', 'modules.user']
    })(store)
  })
}

What happened:

When I refresh the page, the module's data remains, but th date in index.js has been reloaded

Suggested solution: I also want the data in indexjs to be remained,i have already search the questions , but cant find any resolution,could anyone help?😟

solidevolution commented 3 years ago

Same here

robinvdvleuten commented 3 years ago

This does not look like a bug with the plugin but with your application. Please ask for help on either StackOverflow or any Nuxt / Vue related forums.