usePreferredReducedMotion
响应式 prefers-reduced-motion 媒体查询。
演示
用法
ts
import { usePreferredReducedMotion } from '@vueuse/core'
const preferredMotion = usePreferredReducedMotion()组件用法
此函数还通过
@vueuse/components包提供了一个无渲染组件版本。了解更多用法。
vue
<template>
<UsePreferredReducedMotion v-slot="{ motion }">
Preferred Reduced Motion: {{ motion }}
</UsePreferredReducedMotion>
</template>类型声明
ts
export type ReducedMotionType = "reduce" | "no-preference"
/**
* Reactive prefers-reduced-motion media query.
*
* @see https://vueuse.org.cn/usePreferredReducedMotion
* @param [options]
*
* @__NO_SIDE_EFFECTS__
*/
export declare function usePreferredReducedMotion(
options?: ConfigurableWindow,
): ComputedRef<ReducedMotionType>来源
贡献者
更新日志
v13.6.0 于