Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Apply VueUse composables in Vue 3/Nuxt projects to replace custom implementations with battle-tested utilities.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/useMath.md
1---2category: '@Math'3---45# useMath67Reactive `Math` methods.89## Usage1011```ts12import { useMath } from '@vueuse/math'1314const base = ref(2)15const exponent = ref(3)16const result = useMath('pow', base, exponent) // Ref<8>1718const num = ref(2)19const root = useMath('sqrt', num) // Ref<1.4142135623730951>2021num.value = 422console.log(root.value) // 223```2425## Type Declarations2627```ts28export type UseMathKeys = keyof {29[K in keyof Math as Math[K] extends (...args: any) => any30? K31: never]: unknown32}33export type UseMathReturn<K extends keyof Math> = ReturnType<34Reactified<Math[K], true>35>36/**37* Reactive `Math` methods.38*39* @see https://vueuse.org/useMath40*41* @__NO_SIDE_EFFECTS__42*/43export declare function useMath<K extends keyof Math>(44key: K,45...args: ArgumentsType<Reactified<Math[K], true>>46): UseMathReturn<K>47```48