An open API service indexing awesome lists of open source software.

https://github.com/naturalcycles/vue-lib

Useful functions for Vue.js
https://github.com/naturalcycles/vue-lib

typescript vue vuex

Last synced: about 2 months ago
JSON representation

Useful functions for Vue.js

Awesome Lists containing this project

README

        

## @naturalcycles/vue-lib

> Useful functions for Vue.js 2.x

[![npm](https://img.shields.io/npm/v/@naturalcycles/vue-lib/latest.svg)](https://www.npmjs.com/package/@naturalcycles/vue-lib)
[![min.gz size](https://badgen.net/bundlephobia/minzip/@naturalcycles/vue-lib)](https://bundlephobia.com/result?p=@naturalcycles/vue-lib)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)

# Features

## createLocalStoragePlugin

LocalStorage persistence plugin for [Vuex](https://github.com/vuejs/vuex) 3.x (compatible with Vue
2.x).

Works in Nuxt (!).

```ts
interface GlobalState {
count: number
}

const emptyState: GlobalState = {
count: 0,
}

export const localStoragePlugin = createLocalStoragePlugin({
emptyState,
})

export const store = new Vuex.Store({
mutations: {},
plugins: [localStoragePlugin],
})
```