From a6ed23b018343a68f9fd276647cc4af817398d1b Mon Sep 17 00:00:00 2001
From: qingyiay <2386314947@qq.com>
Date: 星期四, 01 二月 2024 15:21:26 +0800
Subject: [PATCH] feat:修改部分问题

---
 src/libs/storage.js |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/src/libs/storage.js b/src/libs/storage.js
index 4602cab..ec51907 100644
--- a/src/libs/storage.js
+++ b/src/libs/storage.js
@@ -8,6 +8,14 @@
     }
     window.localStorage.setItem(name, content);
 }
+export const setSessionStore = (name, content) => {
+    if (!name) return;
+    if (typeof content !== 'string') {
+        content = JSON.stringify(content);
+    }
+    window.sessionStorage.setItem(name, content);
+}
+
 
 /**
  * 鑾峰彇localStorage
@@ -21,6 +29,16 @@
     return v;
 }
 
+export const getSessionStore = name => {
+    if (!name) return;
+    let v = window.sessionStorage.getItem(name);
+    if (v == null) {
+        return "";
+    }
+    return v;
+}
+
+
 /**
  * 鍒犻櫎localStorage
  */

--
Gitblit v1.9.1