From cfce577132832b5291c5bd3b171d7f4397d44643 Mon Sep 17 00:00:00 2001 From: 819527061@qq.com <123456> Date: 星期二, 14 五月 2024 17:06:53 +0800 Subject: [PATCH] docs:参数加密 --- 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