Skip to content

usePreferredContrast

Category
Export Size
522 B
Last Changed
3 hours ago

响应式的 prefers-contrast 媒体查询。

Demo

首选对比度:
no-preference

用法

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

const preferredContrast = usePreferredContrast()

组件使用

vue
<template>
  <UsePreferredContrast v-slot="{ contrast }">
    首选对比度: {{ contrast }}
  </UsePreferredContrast>
</template>

Type Declarations

typescript
export type ContrastType = "more" | "less" | "custom" | "no-preference"
/**
 * Reactive prefers-contrast media query.
 *
 * @see https://vueuse.org/usePreferredContrast
 * @param [options]
 */
export declare function usePreferredContrast(
  options?: ConfigurableWindow,
): ComputedRef<ContrastType>

Source

SourceDemoDocs

Contributors

jorshen

Changelog

No recent changes

Released under the MIT License.