Skip to content

usePreferredReducedMotion

类别
导出体积
557 B
上次更改
2 minutes ago

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

示例

首选动作:
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>

源码

源码演示文档

贡献者

Anthony Fu
一纸忘忧
Anthony Fu
丶远方
vaakian X
Zhao

更新日志

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