跳到主要内容

useMax

分类
导出大小
184 B
@vueuse/math
上次更改
3 个月前

响应式的 Math.max

用法

ts
import { 
useMax
} from '@vueuse/math'
const
array
=
ref
([1, 2, 3, 4])
const
max
=
useMax
(
array
) // Ref<4>
ts
import { 
useMax
} from '@vueuse/math'
const
a
=
ref
(1)
const
b
=
ref
(3)
const
max
=
useMax
(
a
,
b
, 2) // Ref<3>

类型声明

ts
export declare function 
useMax
(
array
:
MaybeRefOrGetter
<
MaybeRefOrGetter
<number>[]>,
):
ComputedRef
<number>
export declare function
useMax
(
...
args
:
MaybeRefOrGetter
<number>[]
):
ComputedRef
<number>

来源

源代码文档

贡献者

Anthony Fu
Anthony Fu
SerKo
IlyaL
Ted Xu
Frank Fang

更新日志

v13.6.0
d32f8 - refactor: 为所有纯函数添加 @__NO_SIDE_EFFECTS__ 注释 (#4907)
v12.8.0
7432f - feat(types): 废弃 MaybeRefMaybeRefOrGetter,转而使用 Vue 的原生类型 (#4636)
0a9ed - feat!: 放弃对 Vue 2 的支持,优化打包并清理 (#4349)

根据 MIT 许可证发布。