'admin-21.05.27:新增utils下的storage.js读取浏览器缓存新写法,建议使用'
This commit is contained in:
parent
dca87eea7e
commit
4cc95c4f8f
@ -37,7 +37,7 @@ export function clearSession() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 新写法,简单易记,建议使用
|
// 新写法,简单易记,建议使用
|
||||||
// 1、window.localStorage 浏览器永久缓存
|
// 1、window.localStorage 浏览器永久缓存
|
||||||
export const Local = {
|
export const Local = {
|
||||||
// 设置永久缓存
|
// 设置永久缓存
|
||||||
set(key: string, val: any) {
|
set(key: string, val: any) {
|
||||||
@ -70,7 +70,7 @@ export const Session = {
|
|||||||
return JSON.parse(json);
|
return JSON.parse(json);
|
||||||
},
|
},
|
||||||
// 移除临时缓存
|
// 移除临时缓存
|
||||||
removeLocal(key: string) {
|
remove(key: string) {
|
||||||
window.sessionStorage.removeItem(key);
|
window.sessionStorage.removeItem(key);
|
||||||
},
|
},
|
||||||
// 移除全部临时缓存
|
// 移除全部临时缓存
|
||||||
|
Loading…
Reference in New Issue
Block a user