@kingt/kt-tool
Advanced tools
+1
-1
| { | ||
| "name": "@kingt/kt-tool", | ||
| "version": "1.7.3", | ||
| "version": "1.7.4", | ||
| "description": "初始化公共方法,引用测试,_kt_引入", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
+18
-10
@@ -51,7 +51,11 @@ // export const tool = { | ||
| export const clearLS = () => { | ||
| Object.keys(localStorage).forEach((key) => { | ||
| if (key.startsWith('kt-int')) { | ||
| localStorage.removeItem(key) | ||
| } | ||
| }) | ||
| try { | ||
| Object.keys(localStorage).forEach((key) => { | ||
| if (typeof key === 'string' && key.startsWith('kt-int')) { | ||
| localStorage.removeItem(key) | ||
| } | ||
| }) | ||
| } catch (error) { | ||
| console.error('清除local存储失败:', error) | ||
| } | ||
| } | ||
@@ -106,7 +110,11 @@ /** | ||
| export const clearSS = () => { | ||
| Object.keys(sessionStorage).forEach((key) => { | ||
| if (key.startsWith('kt-int')) { | ||
| sessionStorage.removeItem(key) | ||
| } | ||
| }) | ||
| try { | ||
| Object.keys(sessionStorage).forEach((key) => { | ||
| if (typeof key === 'string' && key.startsWith('kt-int')) { | ||
| sessionStorage.removeItem(key) | ||
| } | ||
| }) | ||
| } catch (error) { | ||
| console.error('清除session存储失败:', error) | ||
| } | ||
| } | ||
@@ -113,0 +121,0 @@ /** |
1055772
0.02%1710
0.47%