vuex-plugin-persistedstate
Persist and rehydrate your Vuex state between page reloads.
6,371
5
| Install | |
|---|---|
npm install vuex-plugin-persistedstate |
|
| Latest Version: | 1.0.6 |
| Vue: | 3 |
| License: | MIT |
| Last Updated: | Sep 13, 2022 |
| Links: | GitHub · npm |
Maintainer: lgd_sunday
vuex-persistedstate
Persist and rehydrate your Vuex state between page reloads.
robinvdvleuten/vuex-persistedstate Maintenance has stopped, but a lot of developers are still using
vuex-persistedstate, so we try to replace it。will try to keep the same
APIto achieve risk-free replacement.
Install
npm install --save vuex-plugin-persistedstate
The UMD build is also available on unpkg:
<script src="https://unpkg.com/vuex-plugin-persistedstate/dist/index.js"></script>
Usage
import { createStore } from "vuex";
import createPersistedState from "vuex-plugin-persistedstate";
const store = createStore({
// ...
plugins: [createPersistedState()],
});
Compatible with vuex 3 && vuex 4
Examples
Check out a basic example on CodeSandbox.
Options
export interface Options<State> {
/**
* localStorage saved key
*/
key: string
/**
* cached module name
* Do not pass means cache all
* pass only the specified cache
*/
paths: string[]
/**
* storage
*/
storage: Storage
/**
* Whether to prefetch data
*/
fetchBeforeUse: boolean
/**
* Default method of prefetching data
*/
fetchBeforeUseFn: (key: string, storage: Storage) => any
}
License
The MIT License (MIT). Please see License File for more information.
Related Packages
@vuex-orm/core
The Vuex plugin to enable Object-Relational Mapping access to the Vuex Store.
598,633
2,314
@vuex-orm/plugin-search
Vuex ORM plugin for adding fuzzy search feature through model entities.
27,150
42
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 1.0.6 | ^3.2.39 | MIT | |
| 1.0.5 | ^3.2.39 | MIT | |
| 1.0.4 | ^3.2.39 | MIT | |
| 1.0.3 | ^3.2.39 | MIT | |
| 1.0.2 | ^3.2.39 | ISC | |
| 1.0.1 | ^3.2.39 | ISC | |
| 1.0.0 | ^3.2.39 | ISC |