This commit is contained in:
qsh
2024-08-01 18:41:37 +08:00
parent feccb2a1fa
commit 605151c5c8
17 changed files with 143 additions and 137 deletions

View File

@@ -26,7 +26,7 @@ const sessionCache = {
let storage = storageStr ? JSON.parse(storageStr) : {}
return storage[key]
},
remove(key) {
delete(key) {
if (!sessionStorage) {
return null
}
@@ -62,7 +62,7 @@ const localCache = {
let storage = storageStr ? JSON.parse(storageStr) : {}
return storage[key]
},
remove(key) {
delete(key) {
if (!localStorage) {
return null
}
@@ -73,6 +73,10 @@ const localCache = {
let storage = storageStr ? JSON.parse(storageStr) : {}
delete storage[key]
localStorage.setItem(name, JSON.stringify(storage))
},
clear() {
let storage = {}
localStorage.setItem(name, JSON.stringify(storage))
}
}