From 9bec4dcae002f36aa23231da11cb03a156b40110 Mon Sep 17 00:00:00 2001 From: schangxiang@126.com <schangxiang@126.com> Date: 周三, 30 4月 2025 16:24:16 +0800 Subject: [PATCH] 222 --- PipeLineLems/web/src/utils/storage.ts | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-) diff --git a/PipeLineLems/web/src/utils/storage.ts b/PipeLineLems/web/src/utils/storage.ts index c626ed4..240a5dd 100644 --- a/PipeLineLems/web/src/utils/storage.ts +++ b/PipeLineLems/web/src/utils/storage.ts @@ -41,8 +41,13 @@ // 鑾峰彇涓存椂缂撳瓨 get(key: string) { const value: null | string = window.sessionStorage.getItem(key) - if (!value) return null - return JSON.parse(value) + + try { + if (!value) return null + return JSON.parse(value) + } catch (error) { + return value + } }, // 绉婚櫎涓存椂缂撳瓨 remove(key: string) { @@ -54,7 +59,4 @@ }, } -export { - Local, - Session -} \ No newline at end of file +export { Local, Session } -- Gitblit v1.9.3