Skip to content

usePreferredContrast

Category
Export Size
583 B
Last Changed
15 minutes ago

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

Demo

首选对比度:
no-preference

用法

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

const preferredContrast = usePreferredContrast()

组件使用

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

类型声明

typescript
export type ContrastType = "more" | "less" | "custom" | "no-preference"
/**
 * 响应式更喜欢的对比度媒体查询。
 *
 * @see https://vueuse.org/usePreferredContrast
 * @param [options]
 */
export declare function usePreferredContrast(
  options?: ConfigurableWindow,
): ComputedRef<ContrastType>

Source

SourceDemoDocs

贡献者

丶远方
Anthony Fu
Anthony Fu
vaakian X
Zhao

变更日志

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

Released under the MIT License.