Skip to content

usePreferredReducedTransparency

Category
Export Size
Last Changed
3 months ago

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

Demo

Preferred Transparency:
no-preference

用法

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

const preferredTransparency = usePreferredReducedTransparency()

组件用法

vue
<template>
  <UsePreferredReducedTransparency v-slot="{ transparency }">
    首选减少透明度: {{ transparency }}
  </UsePreferredReducedTransparency>
</template>

Type Declarations

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>

Source

SourceDemoDocs

Contributors

丶远方
huiliangShen

Changelog

34cd7 - feat: add new function (#4201)

Released under the MIT License.