Commit a9a95a1c authored by “yiyousong”'s avatar “yiyousong”

perf:修改持久化函数

parent 7c252db5
......@@ -16,8 +16,8 @@ const store = new Vuex.Store({
createPersistedState({
key: "info",
storage: {
getItem: (key) => SessionCrypto.getSS(key),
setItem: (key, value) => SessionCrypto.setSS(key, value),
getItem: (key) => SessionCrypto.getItem(key),
setItem: (key, value) => SessionCrypto.setItem(key, value),
removeItem: (key) => SessionCrypto.remove(key),
},
}),
......
......@@ -70,7 +70,7 @@ const aseKey = "**_FXxx_1234_KEY";
const KEY = "KEY_EXTRA";
export class SessionCrypto {
// 加密
static setSS(key = KEY, value = "") {
static setItem(key = KEY, value = "") {
if (typeof key === "string") {
const stringify = JSON.stringify(value);
const encrypt = CryptoJS.AES.encrypt(
......@@ -86,7 +86,7 @@ export class SessionCrypto {
}
}
// 解密
static getSS(key = KEY) {
static getItem(key = KEY) {
const ssStr = window.sessionStorage.getItem(key) || "";
try {
if (ssStr) {
......
......@@ -17,8 +17,8 @@ const store = new Vuex.Store({
createPersistedState({
key: "info",
storage: {
getItem: (key) => SessionCrypto.getSS(key),
setItem: (key, value) => SessionCrypto.setSS(key, value),
getItem: (key) => SessionCrypto.getItem(key),
setItem: (key, value) => SessionCrypto.setItem(key, value),
removeItem: (key) => SessionCrypto.remove(key),
},
}),
......
......@@ -38,7 +38,7 @@ const aseKey = "**_FXxx_1234_KEY";
const KEY = "KEY_EXTRA";
export class SessionCrypto {
// 加密
static setSS(key = KEY, value = "") {
static setItem(key = KEY, value = "") {
if (typeof key === "string") {
const stringify = JSON.stringify(value);
const encrypt = CryptoJS.AES.encrypt(
......@@ -54,7 +54,7 @@ export class SessionCrypto {
}
}
// 解密
static getSS(key = KEY) {
static getItem(key = KEY) {
const ssStr = window.sessionStorage.getItem(key) || "";
try {
if (ssStr) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment