1.1.0 • Published 3 years ago

@naturalcycles/vue-lib v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

@naturalcycles/vue-lib

Useful functions for Vue.js 2.x

npm min.gz size code style: prettier

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],
})