Skip to content

useLocalStorage

类别
导出体积
1.81 kB
上次更改
3 days ago
相关

响应式的 LocalStorage

使用方法

请参考 useStorage

类型声明

typescript
export declare function useLocalStorage(
  key: MaybeRefOrGetter<string>,
  initialValue: MaybeRefOrGetter<string>,
  options?: UseStorageOptions<string>,
): RemovableRef<string>
export declare function useLocalStorage(
  key: MaybeRefOrGetter<string>,
  initialValue: MaybeRefOrGetter<boolean>,
  options?: UseStorageOptions<boolean>,
): RemovableRef<boolean>
export declare function useLocalStorage(
  key: MaybeRefOrGetter<string>,
  initialValue: MaybeRefOrGetter<number>,
  options?: UseStorageOptions<number>,
): RemovableRef<number>
export declare function useLocalStorage<T>(
  key: MaybeRefOrGetter<string>,
  initialValue: MaybeRefOrGetter<T>,
  options?: UseStorageOptions<T>,
): RemovableRef<T>
export declare function useLocalStorage<T = unknown>(
  key: MaybeRefOrGetter<string>,
  initialValue: MaybeRefOrGetter<null>,
  options?: UseStorageOptions<T>,
): RemovableRef<T>

源码

源码文档

贡献者

Anthony Fu
一纸忘忧
Antério Vieira
Yauheni Vasiukevich
Anthony Fu
ntnyq
Jelf
Shinigami
Pig Fang
Alex Kozack

更新日志

v12.4.0 on 1/10/2025
eb679 - feat(useStorage): make storage key reactive (#4464)
v10.0.0-beta.4 on 4/13/2023
4d757 - feat(types)!: rename MaybeComputedRef to MaybeRefOrGetter