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
Problem 1: Baidu Map uses tiled images (the map i...
Let me first explain why the text is not vertical...
My page today also had garbled characters, so I s...
Mainly discuss its structure and some important pr...
The world-famous virtual machine software VMware-...
In fact, it is very simple to encapsulate axios i...
Today I will introduce two HTML tags that I don’t...
Both methods can be used to execute a piece of ja...
First of all, what is 404 and soft 404? 404: Simpl...
The Docker container provides services and listen...
Table of contents Preface know Practice makes per...
Here is a brief introduction to indexes: The purp...
Technical Background This application uses the vu...
Preface Ordinary users define crontab scheduled t...
At work, we often need remote servers and often e...