init: 初始系统模板

This commit is contained in:
TsMask
2023-09-05 14:38:23 +08:00
parent a5bc16ae4f
commit 1075c8ae4f
130 changed files with 22531 additions and 1 deletions

View File

@@ -0,0 +1,40 @@
/**长期级缓存设置 */
export function localSet(key: string, value: string) {
if (!localStorage || key == null || value == null) {
return;
}
localStorage.setItem(key, value);
}
/**长期级缓存获取 */
export function localGet(key: string) {
if (!localStorage || key == null) {
return null;
}
return localStorage.getItem(key);
}
/**长期级缓存移除 */
export function localRemove(key: string) {
if (!localStorage || key == null) {
return null;
}
return localStorage.removeItem(key);
}
/**长期级缓存设置JSON */
export function localSetJSON(key: string, jsonValue: object) {
if (key == null || jsonValue == null) {
return null;
}
localSet(key, JSON.stringify(jsonValue));
}
/**长期级缓存获取JSON */
export function localGetJSON(key: string) {
const value = localGet(key);
if (value == null) {
return null;
}
return JSON.parse(value);
}