# rcc-lasting

> vuex持久化

Latest version **1.0.3** (published 2018-11-09) · ISC license · 0 weekly downloads

## Install

```sh
npm install rcc-lasting
pnpm add rcc-lasting
yarn add rcc-lasting
bun add rcc-lasting
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2018-11-09 |
| First published | 2018-09-11 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | moxcong |
| Maintainers | moxcong |
| Keywords | vue, vuex, plugin, nuxt |

## Links

- npm: https://www.npmjs.com/package/rcc-lasting
- npm.io page: https://npm.io/package/rcc-lasting

## Recent versions

- 1.0.3 (latest) — 2018-11-09
- 1.0.2 — 2018-09-21
- 1.0.1 — 2018-09-11
- 1.0.0 — 2018-09-11

## README

#rcc-lasting
---
**vuex持久化**
**可以使用sessionStorage，localStorage来分别存储**



##Installation
---
```
$ npm install rcc-lasting -S 
```
##Usage
---
```javascript 
import lasting from 'rcc-lasting'

const store = new Vuex.Store({
  // ...
  plugins: [lasting()]
})
```
**分别使用sessionStorage，localStorage来存储响应的数据**
```javascript 
import lasting from 'rcc-lasting'

const store = new Vuex.Store({
  state:{
    a:'',
    b:''
  }
  // ...
  plugins: [lasting({
    Ls:['a'], //state.a 存储到localStorage
    Ss:['b']  //state.b 存储到sessionStorage
  })]
})
```
**Nuxt.js**
```javascript 
// nuxt.config.js
 
...
plugins: [{ src: 'plugins/storeLasting.js', ssr: false }]
...
```

```javascript 
//  plugins/storeLasting.js

import lasting from 'rcc-lasting'

export default ({ store }) => {
  lasting(
    {
      key: 'vuex',
      Ls:['a'], //state.a 存储到localStorage
      Ss:['b']  //state.b 存储到sessionStorage
    }
  )(store)
}
```
##API
---
**lasting([options])**
- key &lt;String&gt; : 本地存储的key名称。（默认：vuexStorage）
- Ls  &lt;Array&gt; : 需要存到localStorage的key。（默认：[ ]）
- Ss  &lt;Array&gt; : 需要存到sessionStorage的key。（默认：[ ]）

---
_Source: https://npm.io/package/rcc-lasting · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
