主题
createGenericProjection
createProjection
的通用版本。接受自定义投影仪函数来映射任意类型的域。
¥Generic version of createProjection
Accepts a custom projector function to map arbitrary type of domains.
参见 createProjection
和 useProjection
¥Refer to createProjection
and useProjection
类型声明
typescript
export type ProjectorFunction<F, T> = (
input: F,
from: readonly [F, F],
to: readonly [T, T],
) => T
export type UseProjection<F, T> = (input: MaybeRefOrGetter<F>) => ComputedRef<T>
export declare function createGenericProjection<F = number, T = number>(
fromDomain: MaybeRefOrGetter<readonly [F, F]>,
toDomain: MaybeRefOrGetter<readonly [T, T]>,
projector: ProjectorFunction<F, T>,
): UseProjection<F, T>