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
Simply put, delayed replication is to set a fixed...
1. First find the Data file on the migration serv...
In higher versions of Tomcat, the default mode is...
This article uses examples to describe the manage...
If the field storing the name uses the GBK charac...
This article uses an example to describe how to c...
Table of contents background How does element-ui&...
1. MIME: Multipurpose Internet Mail Extensions Th...
Table of contents Install Pagoda Configure Python...
The final result is like this, isn’t it cute… PS:...
This article uses examples to illustrate the usag...
1. Download MySQL database and install and config...
1. Unzip the mysql compressed package to the /usr...
<br />In the page, typesetting is achieved b...
Table of contents Preface Understanding a stack a...