@opensig/opendesign
Version:
18 lines (17 loc) • 873 B
TypeScript
import { MaybeElementRef, UseCssVarOptions } from '@vueuse/core';
import { ComputedRef, MaybeRefOrGetter, Ref } from 'vue';
/**
* 响应式 CSS 变量钩子配置项
*/
export interface UseResponseCssVarOptions<T = string> extends UseCssVarOptions {
/** 防抖延迟(毫秒),默认 100ms */
debounce?: number;
/** 对 CSS 变量值进行转换处理 */
transform?: (value: string) => T;
}
/**
* 响应式 CSS 变量钩子
* 在 useCssVar 基础上监听窗口宽度变化,解决媒体查询触发的 CSS 变量更新不响应问题
*/
export declare function useResponseCssVar(prop: MaybeRefOrGetter<string>, target?: MaybeElementRef, options?: UseResponseCssVarOptions): Ref<string>;
export declare function useResponseCssVar<T>(prop: MaybeRefOrGetter<string>, target?: MaybeElementRef, options?: UseResponseCssVarOptions<T>): ComputedRef<T>;