(name: string, defaultValue = '')
| 64 | * @param defaultValue 默认🈯️ |
| 65 | */ |
| 66 | export function getLocalStorage(name: string, defaultValue = ''): string { |
| 67 | if (window.localStorage) { |
| 68 | const value = window.localStorage.getItem(name); |
| 69 | if (value) { |
| 70 | return value; |
| 71 | } |
| 72 | } |
| 73 | return defaultValue; |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * 设置LocalStorage name对应值 |