Vuex LocaleStorage plugin for nuxt.js

↘锁芯ラ 提交于 2021-01-29 10:17:09

问题


In my project, I faced with a problem the cookie technology and I can't use it because my client gets problems with it because cookies should have some button for notification, and the user might not approve it.

My question is:
Are there any solutions (modules possible) to solve such problems? If yes - what can you recommend first of all?

In my project, I need to get data in middleware(in SSR mode) from VUEX and I need to save it after refresh pages.

If it possible - need to save session data for other browsers or another tab's the current browser. Is it real without a cookie using?


回答1:


If you want to persist Vuex Data you can use vuex-persist

Which will persist your data on-page.

With vuex-persist you have 3-4 options to store vuex data

  1. js-cookie to use browser Cookies
  2. window.localStorage (remains, across PC reboots, untill you clear browser data)
  3. window.sessionStorage (vanishes when you close browser tab)
  4. localForage Uses IndexedDB from the browser


来源:https://stackoverflow.com/questions/62055571/vuex-localestorage-plugin-for-nuxt-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!