feat:添加表单颜色选择和表格颜色显示

Signed-off-by: 懂不能懂 <295047320@qq.com>
This commit is contained in:
懂不能懂 2022-11-17 11:50:28 +00:00 committed by 妙码生花
parent 95a3309df6
commit f364e6dded
4 changed files with 21 additions and 1 deletions

View File

@ -24,6 +24,7 @@ export const inputTypes = [
'file',
'files',
'icon',
'color'
]
export type modelValueTypes = string | number | boolean | object

View File

@ -375,6 +375,17 @@ export default defineComponent({
})
},
],
[
'color',
() => {
return () =>
createVNode(resolveComponent('el-color-picker'), {
modelValue: props.modelValue,
'onUpdate:modelValue': onValueUpdate,
...props.attr,
})
},
],
[
'editor',
() => {

View File

@ -96,6 +96,7 @@ export default defineComponent({
'remoteSelect',
'city',
'icon',
'color'
] // label
let needLabelSlot = ['radio', 'checkbox', 'switch', 'array', 'image', 'images', 'file', 'files', 'editor'] // label
if (noNeedLabelSlot.includes(props.type)) {

View File

@ -90,7 +90,10 @@
<div v-if="field.render == 'datetime'">
{{ !fieldValue ? '-' : timeFormat(fieldValue, field.timeFormat ?? undefined) }}
</div>
<!-- color -->
<div v-if="field.render == 'color'">
<div :style="{background:fieldValue}" class="el-color"></div>
</div>
<!-- customTemplate 自定义模板 -->
<div
v-if="field.render == 'customTemplate'"
@ -305,4 +308,8 @@ const getTagType = (value: string, custom: any): TagProps['type'] => {
.ml-6 + .el-button {
margin-left: 6px;
}
.el-color{
height:25px;
width:100%
}
</style>