Skip to content

usePreferredReducedMotion

Category
Export Size
557 B
Last Changed
15 minutes 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>

类型声明

typescript
export type ReducedMotionType = "reduce" | "no-preference"
/**
 *  响应式动画偏好媒体查询
 *
 * @see https://vueuse.org/usePreferredReducedMotion
 * @param [options]
 */
export declare function usePreferredReducedMotion(
  options?: ConfigurableWindow,
): ComputedRef<ReducedMotionType>

Source

SourceDemoDocs

贡献者

丶远方
Anthony Fu
Anthony Fu
vaakian X
Zhao

变更日志

v9.11.0 on 1/17/2023
d5321 - fix(components): mark defineComponent as pure (#2623)

Released under the MIT License.