安装:

  npm install --save vuex-persistedstate

引用:

  import createPersistedState from 'vuex-persistedstate'

配置:

  new Vuex.Store({plugins: [createPersistedState()] })

作用:

  将 vuex 状态保存到 localstorage 中

相关文章: