@naturalcycles/vue-lib
v1.1.0
Published
Useful functions for Vue.js
Downloads
13
Readme
@naturalcycles/vue-lib
Useful functions for Vue.js 2.x
Features
createLocalStoragePlugin
LocalStorage persistence plugin for Vuex 3.x (compatible with Vue 2.x).
Works in Nuxt (!).
interface GlobalState {
count: number
}
const emptyState: GlobalState = {
count: 0,
}
export const localStoragePlugin = createLocalStoragePlugin<GlobalState>({
emptyState,
})
export const store = new Vuex.Store<GlobalState>({
mutations: {},
plugins: [localStoragePlugin],
})