Skip to content
目录

Color Picker Panel 颜色选择器面板

用于在面板中选择颜色,支持 Hue(色相)与可选 Alpha(透明度),并可通过输入框粘贴 #RGB/#RRGGBBrgb()/rgba() 进行回写。

基础用法

html
<template>
  <dk-color-picker-panel v-model="value" />
</template>

<script setup>
import { ref } from 'vue'

const value = ref('#409EFF')
</script>
展开

透明度(show-alpha)

html
<template>
  <dk-color-picker-panel v-model="value" show-alpha format="rgb" />
</template>
展开

禁用

html
<template>
  <dk-color-picker-panel v-model="value" disabled />
</template>
展开

属性

属性名说明类型默认值
model-value / v-model绑定值string''
disabled是否禁用booleanfalse
show-alpha是否显示透明度条booleanfalse
format输出格式'hex' | 'rgb' | 'hsl''hex'
width面板宽度string'280px'

事件

事件名说明回调参数
update:modelValuev-model 更新(value: string)
active-change拖动过程中实时回调(value: string)
change结束拖动/输入框回写后的变更(value: string)
update:rgbaRGBA 更新(rgba: { r: number; g: number; b: number; a: number })

Contributors

Mr.Fan