This commit is contained in:
Ruin
2022-03-09 11:48:11 +08:00
parent 76b499fba6
commit 8647de8177
9 changed files with 95 additions and 47 deletions

View File

@@ -4,7 +4,7 @@
* @Author: Ruin 🍭
* @Date: 2022-03-07 09:39:15
* @LastEditors: 刘引
* @LastEditTime: 2022-03-07 15:08:49
* @LastEditTime: 2022-03-07 16:51:22
*/
import { Injectable } from "@angular/core";
@@ -13,25 +13,6 @@ import { Injectable } from "@angular/core";
})
export class StorageService {
constructor() {}
public msg: string = "我是信息";
getTest() {
return "this is service";
}
// 添加缓存
setStorage(key: any, value: any) {
localStorage.setItem(key, JSON.stringify(value));
}
// 读取缓存
getStorage(key: any): any {
return localStorage.getItem(key);
}
// 删除指定缓存
removeStorage(key: any): any {
localStorage.removeItem(key);
}
// 删除所有缓存
clearStorage() {
localStorage.clear();
}
// 定义公共数据
public inputData: string = "";
}