# vuex-persist-plugin-ts

> vuex-persist-plugin是一个vuex的插件，支持vuex4以及ts。此插件配置项非常简单，只需要告知插件storage的名字、需要保存的state以及storage的种类（支持localstorage、sessionstorage）即可

Latest version **1.1.0** (published 2022-07-07) · ISC license · 0 weekly downloads

## Install

```sh
npm install vuex-persist-plugin-ts
pnpm add vuex-persist-plugin-ts
yarn add vuex-persist-plugin-ts
bun add vuex-persist-plugin-ts
```

## 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.1.0 |
| Published | 2022-07-07 |
| First published | 2022-07-06 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 8.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | chenxinlong |
| Maintainers | chenxinlong |
| Keywords | vue, vue2, vue3, vuex, vuex-persist, vuex-persist-state, vuex-persisted, vuex-persister, vuex-persist-plugin, how to persist vuex state |

## Links

- npm: https://www.npmjs.com/package/vuex-persist-plugin-ts
- Repository: https://github.com/xinlong-chen865/vuex-persist-plugin
- Homepage: https://github.com/xinlong-chen865/vuex-persist-plugin#readme
- Issues: https://github.com/xinlong-chen865/vuex-persist-plugin/issues
- npm.io page: https://npm.io/package/vuex-persist-plugin-ts

## Dependencies (1)

- [deepmerge](https://npm.io/package/deepmerge.md) ^4.2.2

## Recent versions

- 1.1.0 (latest) — 2022-07-07
- 1.0.0 — 2022-07-06

## README

## 功能
vuex-persist-plugin是一个vuex的插件，支持vuex4以及ts。此插件配置项非常简单，只需要告知插件storage的名字、需要保存的state以及storage的种类（支持localstorage、sessionstorage）即可
<br /> <br />

## 用法
支持保存整个module的数据，并支持保存module中某一个state的数据
```
import { createStore } from 'vuex'
import VuexPersister from "vuex-persist-plugin-ts";

const vuexPersister = new VuexPersister({
  key: 'my_key',
  saveParams: ['count', 'A.number'],
});

export default createStore({
  state: {
    count: 0,
    age: 0,
  },
  modules: {
    A: {
      namespaced: true,
      state: {
        number: 0,
      },
    }
  },
  plugins: [
    vuexPersister.bootstrap,
  ]
})
```
<br /><br />
## 配置项
| 参数名 | 可选值 | 含义 | 默认值 |
| ----- | ----- | --- | --- |
| storage | localstorage / sessionstorage / 空 | storage种类 | localstorage |
| saveParams | ['username', 'music.musicName'] / 空 | 需要加缓存的路径 | [] |
| key | 'my-vuex' / 空 | 缓存key的命名 | 'vuex-persist-plugin' |

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