Skip to content

useAbs

反应式 Math.abs

¥Reactive Math.abs.

用法

¥Usage

ts
import { useAbs } from '@vueuse/math'

const value = ref(-23)
const absValue = useAbs(value) // Ref<23>

类型声明

typescript
/**
 * Reactive `Math.abs`.
 *
 * @see https://vueuse.org/useAbs
 */
export declare function useAbs(
  value: MaybeRefOrGetter<number>,
): ComputedRef<number>

源代码

源代码文档

变更日志

v12.8.0 on 3/5/2025
7432f - feat(types): deprecate MaybeRef and MaybeRefOrGetter in favor of Vue's native (#4636)

VueUse v13.0 中文网 - 粤ICP备13048890号