Skip to content

ColorPicker 颜色选择器 ​

用于颜色选择,支持多种格式。

基础用法 ​

选择透明度 ​

预定义颜色 ​

不同尺寸 ​

API ​

Props ​

参数说明类型默认值
model-value / v-model选中项绑定值string—
disabled是否禁用booleanfalse
size尺寸enum—
show-alpha是否支持透明度选择booleanfalse
color-format写入 v-model 的颜色的格式enum—
popper-classColorPicker 下拉框的类名string—
predefine预定义颜色object—
tabindexColorPicker 的 tabindexstring / number0
idColorPicker 的 idstring—

Events ​

事件名说明类型
change当绑定值变化时触发Function
active-change面板中当前显示的颜色发生改变时触发Function

方法 ​

通过 ref 可以获取到 ColorPicker 实例并调用实例方法,详见组件实例方法。

名称说明类型
color当前色彩对象object
show手动显示颜色选择器Function
hide手动隐藏颜色选择器Function

类型定义 ​

组件导出以下类型定义:

ts
import type { ColorPickerProps, ColorPickerInstance } from 'ryxon'

主题定制 ​

样式变量 ​

组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 ConfigProvider 组件。

名称默认值描述
--r-color-picker-width32px颜色选择器的宽度
--r-color-picker-height32px颜色选择器的高度
--r-color-picker-alpha-bg-a#ccc-
--r-color-picker-alpha-bg-btransparent-

Released under the MIT License.