Skip to content

createGenericProjection ​

类别
导出体积
97 B
依赖包
@vueuse/math
上次更改
last year
相关

createGenericProjection 是 createProjection 的通用版本。它接受一个自定义的投影函数,用于映射任意类型的域。

请参考 createProjection 和 useProjection。

类型声明 ​

ts
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
>

源码 ​

源码 • 文档

贡献者 ​

一纸忘忧
Anthony Fu
Anthony Fu
SerKo
IlyaL

更新日志 ​

d32f8 - refactor: add @__NO_SIDE_EFFECTS__ annotations to all pure functions (#4907)
7432f - feat(types): deprecate MaybeRef and MaybeRefOrGetter in favor of Vue's native (#4636)
59f75 - feat(toValue): deprecate toValue from @vueuse/shared in favor of Vue's native
0a9ed - feat!: drop Vue 2 support, optimize bundles and clean up (#4349)