vuex-persistedstate
import persistedState from 'vuex-persistedstate' const store = new Vuex.Store({ // ... plugins: [persistedState()] }) import persistedState from "vuex-persistedstate" const store = new Vuex.Store({ // ... plugins: [persistedState ({ storage: window.sessionStorage })] })
import Cookies from 'js-cookie'; import persistedState from "vuex-persistedstate" const store = new Vuex.Store({ // ... plugins: [persistedState ({ storage: getItem: key => Cookies.get(key), setItem: (key, value) => Cookies.set(key, value), removeItem: key => Cookies.remove(key) } })] }) secure-ls
import Vue from "vue"; import Vuex from "vuex"; import SecureLS from 'secure-ls'; import persistedState from "vuex-persistedstate"; const ls = new SecureLS({ encodingType: "aes", // encryption method isCompression: false, // whether to enable data compression encryptionSecret: "old-beauty" // }); Vue.use(Vuex); export default new Vuex.Store({ ... plugins: [persistedState({ // key: "123123", // key to store in storage storage: getItem: key => ls.get(key), setItem: (key, value) => ls.set(key, value), removeItem: key => ls.remove(key) } })], }); [Note] This is the end of this article about vuex forced data loss. For more relevant vuex data loss content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: mysql executes sql file and reports error Error: Unknown storage engine'InnoDB' solution
>>: Customization Method of Linux Peripheral File System
Format Encoding 1. Please set the page width with...
This article shares the specific code of Vue.js t...
<br />The website access speed can directly ...
Previously, I introduced the use of the charAt() ...
Table of contents 1. Basic environment configurat...
introduce A chart is a graphical representation o...
Sometimes it is slow to download large network fi...
The multi-site feature of WordPress allows you to...
Table of contents Preface 1. Recursive components...
Abstract: Many companies, even most companies whos...
Openlayers is a modular, high-performance and fea...
Docker virtualizes a bridge on the host machine. ...
Chatbots can save a lot of manual work and can be...
Table of contents 1. Environment variable $PATH: ...
Table of contents Overview 1. RangeError 2. Refer...