(key: string)
| 85 | * @author: 白雾茫茫丶 |
| 86 | */ |
| 87 | export const getLocalStorageItem = <T>(key: string): T | null => { |
| 88 | // 获取 值 |
| 89 | const item = localStorage.getItem(key); |
| 90 | // 判断是否为空 |
| 91 | if (item === null) { |
| 92 | return null; |
| 93 | } |
| 94 | // 不为空返回解析后的值 |
| 95 | const result: T = JSON.parse(item); |
| 96 | return result |
| 97 | } |
| 98 | |
| 99 | /** |
| 100 | * @description: 存储 localstorage 的值 |
no outgoing calls
no test coverage detected