Skip to content

useStorageAsync

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

具有异步支持的响应式 Storage。

用法

请参考 useStorage

类型声明

显示类型声明
typescript
export interface UseStorageAsyncOptions<T>
  extends Omit<UseStorageOptions<T>, "serializer"> {
  /**
   * 自定义数据序列化
   */
  serializer?: SerializerAsync<T>
}
export declare function useStorageAsync(
  key: string,
  initialValue: MaybeRefOrGetter<string>,
  storage?: StorageLikeAsync,
  options?: UseStorageAsyncOptions<string>,
): RemovableRef<string>
export declare function useStorageAsync(
  key: string,
  initialValue: MaybeRefOrGetter<boolean>,
  storage?: StorageLikeAsync,
  options?: UseStorageAsyncOptions<boolean>,
): RemovableRef<boolean>
export declare function useStorageAsync(
  key: string,
  initialValue: MaybeRefOrGetter<number>,
  storage?: StorageLikeAsync,
  options?: UseStorageAsyncOptions<number>,
): RemovableRef<number>
export declare function useStorageAsync<T>(
  key: string,
  initialValue: MaybeRefOrGetter<T>,
  storage?: StorageLikeAsync,
  options?: UseStorageAsyncOptions<T>,
): RemovableRef<T>
export declare function useStorageAsync<T = unknown>(
  key: string,
  initialValue: MaybeRefOrGetter<null>,
  storage?: StorageLikeAsync,
  options?: UseStorageAsyncOptions<T>,
): RemovableRef<T>

源码

源码文档

贡献者

Anthony Fu
一纸忘忧
Anthony Fu
Jelf
Fernando Fernández
Alex Liu
Doctorwu
丶远方
Wu Rui
ntnyq
Waldi
Andreas Weber

更新日志

v12.4.0 on 1/10/2025
dd316 - feat: use passive event handlers everywhere is possible (#4477)
v12.3.0 on 1/2/2025
e6a17 - fix: correct initialization when initialValue is getter (#4452)
59f75 - feat(toValue): deprecate toValue from @vueuse/shared in favor of Vue's native
v12.0.0-beta.1 on 11/21/2024
0a9ed - feat!: drop Vue 2 support, optimize bundles and clean up (#4349)
v10.7.2 on 1/14/2024
c197e - fix: correct ssr handler (#3703)
v10.0.0-beta.5 on 4/13/2023
cb644 - refactor!: remove isFunction and isString utils
v10.0.0-beta.4 on 4/13/2023
4d757 - feat(types)!: rename MaybeComputedRef to MaybeRefOrGetter
0a72b - feat(toValue): rename resolveUnref to toValue
v9.13.0 on 2/18/2023
105f4 - fix: handle mergeDefaults option (#2773)