问题
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
- js-cookie to use browser Cookies
- window.localStorage (remains, across PC reboots, untill you clear browser data)
- window.sessionStorage (vanishes when you close browser tab)
- localForage Uses IndexedDB from the browser
来源:https://stackoverflow.com/questions/62055571/vuex-localestorage-plugin-for-nuxt-js