ColorPicker 颜色选择框
规则
基础示例
Props 配置示例
禁用透明度
预设颜色
尺寸对比(小 / 中 / 大)
禁用
Events 事件示例
监听颜色变化
颜色选择后联动更新
完整配置项:TDesign_ColorPicker
value:string
Props
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|---|---|---|---|---|
| borderless | 无边框模式 | boolean | false | - |
| clearable | 是否可清空 | boolean | false | - |
| colorModes | 颜色模式 | Array<'monochrome' | 'linear-gradient'> | ['monochrome','linear-gradient'] | - |
| disabled | 是否禁用 | boolean | - | - |
| enableAlpha | 是否开启透明通道 | boolean | false | - |
| enableMultipleGradient | 是否允许点击渐变轴增加梯度 | boolean | true | - |
| format | 格式化色值 | HEX | HEX8 | RGB | RGBA | HSL | HSLA | HSV | HSVA | CMYK | CSS | RGB | - |
| inputProps | 透传 Input 属性 | InputProps | - | - |
| popupProps | 透传 Popup 属性 | PopupProps | - | - |
| recentColors | 最近使用颜色(v-model:recentColors) | Array<string> | boolean | null | [] | - |
| defaultRecentColors | 非受控最近使用颜色 | Array<string> | boolean | null | [] | - |
| selectInputProps | 透传 SelectInput 属性 | SelectInputProps | - | - |
| showPrimaryColorPreview | 是否展示颜色预览区域 | boolean | true | - |
| size | 尺寸 | small | medium | large | medium | - |
| swatchColors | 系统预设色样(null/[] 不显示,undefined 用内置) | Array<string> | null | - | - |
| value | 色值 | string | - | - |
| defaultValue | 非受控色值 | string | - | - |
Events
| 事件 | 说明 | 类型 | 版本 |
|---|---|---|---|
| change | 色值变化 | (value: string, context: { color: ColorObject; trigger: ColorPickerChangeTrigger }) => void | - |
| clear | 清空 | (context: { e: MouseEvent }) => void | - |
| paletteBarChange | 调色板控制器值变化 | (context: { color: ColorObject }) => void | - |
| recentColorsChange | 最近使用颜色变化 | (value: Array<string>) => void | - |


