Skip to content

Color Picker ​

Vue 已实现 · 还原验收 0/1 · 上游演示 · 固定版本源码

预览 ​

用法 ​

vue
<script setup lang="ts">
import { ColorPicker } from 'beui-vue'
import { ref } from 'vue'
const color = ref('#3478f6')
const presets = [
  { label: 'Blue', value: '#3478f6' }, { label: 'Purple', value: '#9270e8' },
  { label: 'Pink', value: '#e66aa4' }, { label: 'Red', value: '#e55656' },
  { label: 'Orange', value: '#ed9141' }, { label: 'Amber', value: '#e5b63c' },
  { label: 'Green', value: '#65a65a' }, { label: 'Teal', value: '#169d83' },
]
</script>
<template><div class="preview"><ColorPicker v-model="color" :presets="presets" label="Brand color" /></div></template>
<style scoped>.preview { min-height: 22rem; display: flex; justify-content: center; align-items: flex-start; padding: 1rem; }</style>

API ​

v-model 为 RGB 或 RGBA 十六进制字符串。使用 presets 设置预设色,v-model:open 控制浮层。支持键盘调整、透明度、HEX/RGB/HSL 输入和浏览器取色器。

还原验收 ​

基于 beUI 的独立 Vue 移植,依 MIT 许可证分发。