因为业务需要用到颜色选择器,但ant-design-vue里没这个组件,所以在网上找到了一个封装好的。这是组件的仓库地址 https://gitee.com/ghkeeping/ant-color-picker?_from=gitee_search

vue3+typeScript基于ant-design-vue2.xx版本封装的颜色选择器

效果

 

参数说明类型可选值默认值
value/v-model绑定值string
size尺寸stringlarge/default/smalldefault
show-alpha是否支持透明度选择booleanfalse
color-format写入v-model的颜色格式stringhsl/hsv/hex/rgbhex(show-alpha 为 false)/ rgb(show-alpha 为 true)
predefine预定义颜色array
placement颜色选择器弹出位置stringtop left right bottom topLeft topRight bottomLeft bottomRight leftTop leftBottom rightTop rightBottomtop

 Events

        事件名称说明回调参数
change当绑定值变化时触发当前值
active-change面板中当前显示的颜色发生改变时触发当前显示的颜色值

引入封装好的组件

import { colorPicker } from '/@/components/ColorPicker';

使用

<colorPicker v-model="configure.FontColor" @change="selectColorPicker" />

Logo

基于 Vue 的企业级 UI 组件库和中后台系统解决方案,为数万开发者服务。

更多推荐