PaintField
设计类宿主的填充行(Figma 填充、PPT 形状填充):一个格子里切纯色与图片。行内同 ColorField(色块 + 十六进制框),图片态时色块换成缩略图、框里占位写图片名;浮层顶上分「颜色 / 图片」两页,颜色页是取色面板,图片页是缩略图加来源按钮与「调整」。
纯色与图片两态
纯色:#3B82F6
- 值分两路:纯色走
v-model(十六进制),图片态由image({ thumbnail?, name })给;图片态时格子里打十六进制照样提交成纯色,宿主在commit里清掉图片。 - 来源按钮(
sources)与调整(adjust)只发pick(source)/adjust,取图、裁剪由宿主做;adjust只在图片态画。 - 打开时与外面换态时落到对应的那页,开着时用户自己切的页不被回传冲掉。两页标题缺省「颜色 / 图片」,用
tabs换。 - 建在
XColorField的#panel-top/#panel插槽上,开合、色块、输入框与input/commit节奏都归格子。
API
Props
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
label | string | undefined | — | 可访问名与悬停提示 |
image | PaintImage | undefined | — | 图片态时给;纯色态不给(颜色走 v-model) |
mixed | boolean | undefined | — | 多个值(选中的几项填充不同):格子空着、占位「多个值」 |
tabs | { color: string; image: string; } | undefined | — | 两页的标题,缺省「颜色 / 图片」(文案包里的 `paintField`) |
sources 必填 | PaintSource[] | — | 图片页的来源按钮 |
adjust | { icon: string; label: string; } | undefined | — | 图片页的「调整」按钮(进调整模式);不给不画,纯色态也不画 |
popoverProps | Partial<PopoverProps> | undefined | — | 浮层方位,同 `XColorField` 的 `popoverProps` |
modelValue | string | undefined | — | — |
Emits
| 事件 | 载荷 | 说明 |
|---|---|---|
update:modelValue | [value: string | undefined] | — |
input | [value: string] | — |
commit | [value: string | undefined] | — |
pick | [source: string] | — |
adjust | [] | — |