Skip to content

usePreferredReducedTransparency

类别
导出体积
上次更改
3 weeks ago

Reactive prefers-reduced-transparency media query.

示例

Preferred Transparency:
no-preference

Usage

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

const preferredTransparency = usePreferredReducedTransparency()

Component Usage

This function also provides a renderless component version via the @vueuse/components package. Learn more about the usage.

vue
<template>
  <UsePreferredReducedTransparency v-slot="{ transparency }">
    Preferred Reduced transparency: {{ transparency }}
  </UsePreferredReducedTransparency>
</template>

类型声明

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

源码

源码演示文档

贡献者

huiliangShen

更新日志

v12.2.0-beta.1 on 12/23/2024
34cd7 - feat: add new function (#4201)