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
1. Download related tools and images Download Lin...
Running environment, Idea2020 version, Tomcat10, ...
01. Command Overview The paste command will merge...
wedge Because the MySQL version installed on the ...
Vertical Split Vertical splitting refers to the s...
Scenario The company project is deployed in Docke...
Unlike other types of design, web design has been ...
Table of contents 1. Ant Design Vue 1. Official w...
Table of contents 1 Question 2 Methods 3 Experime...
Introduction to IPSec IPSec (Internet Protocol Se...
This article originated from the homework assignm...
Table of contents Quick Start How to use Core Pri...
1. Command Introduction The tac (reverse order of...
This article example shares the specific code of ...
Table of contents Achieve results Available plugi...