Skip to content

usePreferredContrast

类别
导出体积
1.24 kB
上次更改
1 hour ago

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

示例

首选对比度:
no-preference

用法

ts
import { 
usePreferredContrast
} from '@vueuse/core'
const
preferredContrast
=
usePreferredContrast
()

组件使用

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

类型声明

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

源码

源码演示文档

贡献者

一纸忘忧

更新日志

没有最近的更新日志