Closed Chu-Te-Ethan-Chen closed 3 years ago
vuex-persistedstate
node
npm
yarn
Relevant code or config
import Vue from 'vue' import Vuex from 'vuex' import user from './modules/user' import createPersistedState from 'vuex-persistedstate' import SecureLS from 'secure-ls' var ls = new SecureLS({ isCompression: false }) Vue.use(Vuex) export default new Vuex.Store({ plugins: [createPersistedState({ storage: { getItem: (key) => ls.get(key), setItem: (key, value) => ls.set(key, value), removeItem: (key) => ls.remove(key), }, fetchBeforeUse: true, })], state: { }, mutations: { }, actions: { }, getters: { }, modules: { user, } })
What you did: I set fetchBeforeUse: true in option. And I wish the new tab can getState from localstorage.
fetchBeforeUse: true
What happened: The new tab does not getState from localstorage.
Problem description: Is there an example to demonstrate the fetchBeforeUse feature ? Thanks!
I find out that window.addEventListener('storage', (e) => { }) can meet my need. ref: #234
window.addEventListener('storage', (e) => { })
vuex-persistedstate
version: 4.0.0-beta.3node
version: v12.18.3npm
(oryarn
) version: yarn 1.22.5Relevant code or config
What you did: I set
fetchBeforeUse: true
in option. And I wish the new tab can getState from localstorage.What happened: The new tab does not getState from localstorage.
Problem description: Is there an example to demonstrate the fetchBeforeUse feature ? Thanks!