Skip to content

usePreferredReducedMotion

Category
Export Size
499 B
Last Changed
3 hours ago

响应式的prefers-reduced-motion媒体查询。

Demo

首选动作:
no-preference

用法

js
import { usePreferredReducedMotion } from '@vueuse/core'

const preferredMotion = usePreferredReducedMotion()

组件使用

vue
<template>
  <UsePreferredReducedMotion v-slot="{ motion }">
    首选减少动作: {{ motion }}
  </UsePreferredReducedMotion>
</template>

Type Declarations

typescript
export type ReducedMotionType = "reduce" | "no-preference"
/**
 * Reactive prefers-reduced-motion media query.
 *
 * @see https://vueuse.org/usePreferredReducedMotion
 * @param [options]
 */
export declare function usePreferredReducedMotion(
  options?: ConfigurableWindow,
): ComputedRef<ReducedMotionType>

Source

SourceDemoDocs

Contributors

jorshen

Changelog

No recent changes

Released under the MIT License.