From 31da01bdd1e4fe8fb8eec41f401d73bcf6cc18b7 Mon Sep 17 00:00:00 2001 From: ahao <liuhaoai545@gmail.com> Date: 星期六, 06 一月 2024 17:27:01 +0800 Subject: [PATCH] fix https://gitee.com/dromara/RuoYi-Vue-Plus/issues/I8TMAI --- src/plugins/cache.ts | 140 +++++++++++++++++++++++----------------------- 1 files changed, 70 insertions(+), 70 deletions(-) diff --git a/src/plugins/cache.ts b/src/plugins/cache.ts index c3cc7eb..cf43680 100644 --- a/src/plugins/cache.ts +++ b/src/plugins/cache.ts @@ -1,77 +1,77 @@ const sessionCache = { - set(key: string, value: any) { - if (!sessionStorage) { - return; - } - if (key != null && value != null) { - sessionStorage.setItem(key, value); - } - }, - get(key: string) { - if (!sessionStorage) { - return null; - } - if (key == null) { - return null; - } - return sessionStorage.getItem(key); - }, - setJSON(key: string, jsonValue: any) { - if (jsonValue != null) { - this.set(key, JSON.stringify(jsonValue)); - } - }, - getJSON(key: string) { - const value = this.get(key); - if (value != null) { - return JSON.parse(value); - } - }, - remove(key: string) { - sessionStorage.removeItem(key); - } + set(key: string, value: any) { + if (!sessionStorage) { + return; + } + if (key != null && value != null) { + sessionStorage.setItem(key, value); + } + }, + get(key: string) { + if (!sessionStorage) { + return null; + } + if (key == null) { + return null; + } + return sessionStorage.getItem(key); + }, + setJSON(key: string, jsonValue: any) { + if (jsonValue != null) { + this.set(key, JSON.stringify(jsonValue)); + } + }, + getJSON(key: string) { + const value = this.get(key); + if (value != null) { + return JSON.parse(value); + } + }, + remove(key: string) { + sessionStorage.removeItem(key); + } }; const localCache = { - set(key: string, value: any) { - if (!localStorage) { - return; - } - if (key != null && value != null) { - localStorage.setItem(key, value); - } - }, - get(key: string) { - if (!localStorage) { - return null; - } - if (key == null) { - return null; - } - return localStorage.getItem(key); - }, - setJSON(key: string, jsonValue: any) { - if (jsonValue != null) { - this.set(key, JSON.stringify(jsonValue)); - } - }, - getJSON(key: string) { - const value = this.get(key); - if (value != null) { - return JSON.parse(value); - } - }, - remove(key: string) { - localStorage.removeItem(key); - } + set(key: string, value: any) { + if (!localStorage) { + return; + } + if (key != null && value != null) { + localStorage.setItem(key, value); + } + }, + get(key: string) { + if (!localStorage) { + return null; + } + if (key == null) { + return null; + } + return localStorage.getItem(key); + }, + setJSON(key: string, jsonValue: any) { + if (jsonValue != null) { + this.set(key, JSON.stringify(jsonValue)); + } + }, + getJSON(key: string) { + const value = this.get(key); + if (value != null) { + return JSON.parse(value); + } + }, + remove(key: string) { + localStorage.removeItem(key); + } }; export default { - /** - * 浼氳瘽绾х紦瀛� - */ - session: sessionCache, - /** - * 鏈湴缂撳瓨 - */ - local: localCache + /** + * 浼氳瘽绾х紦瀛� + */ + session: sessionCache, + /** + * 鏈湴缂撳瓨 + */ + local: localCache }; -- Gitblit v1.9.3