2020-07-28 10:03:53 +08:00
|
|
|
---
|
|
|
|
title: Color 颜色
|
2021-01-07 23:35:03 +08:00
|
|
|
description:
|
2020-07-28 10:03:53 +08:00
|
|
|
type: 0
|
|
|
|
group: ⚙ 组件
|
|
|
|
menuName: Color
|
2021-01-07 23:35:03 +08:00
|
|
|
icon:
|
2020-07-28 10:03:53 +08:00
|
|
|
order: 37
|
|
|
|
---
|
2021-01-07 23:35:03 +08:00
|
|
|
|
2020-07-28 10:03:53 +08:00
|
|
|
用于展示颜色
|
|
|
|
|
|
|
|
## 基本用法
|
|
|
|
|
2021-01-07 23:35:03 +08:00
|
|
|
```schema
|
2020-07-28 10:03:53 +08:00
|
|
|
{
|
|
|
|
"type": "page",
|
|
|
|
"body": {
|
|
|
|
"type": "color",
|
|
|
|
"value": "#108cee"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## 用作 Field 时
|
|
|
|
|
2021-01-07 23:35:03 +08:00
|
|
|
当用在 Table 的列配置 Column、List 的内容、Card 卡片的内容和表单的 Static-XXX 中时,可以设置`name`属性,映射同名变量
|
2020-07-28 10:03:53 +08:00
|
|
|
|
|
|
|
### Table 中的列类型
|
|
|
|
|
2021-01-07 23:35:03 +08:00
|
|
|
```schema: scope="body"
|
2020-07-28 10:03:53 +08:00
|
|
|
{
|
|
|
|
"type": "table",
|
|
|
|
"data": {
|
|
|
|
"items": [
|
|
|
|
{
|
|
|
|
"id": "1",
|
|
|
|
"color": "#108cee"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "2",
|
|
|
|
"color": "#f38900"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "3",
|
|
|
|
"color": "#04c1ba"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"columns": [
|
|
|
|
{
|
|
|
|
"name": "id",
|
|
|
|
"label": "Id"
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
"name": "color",
|
|
|
|
"label": "颜色",
|
|
|
|
"type": "color"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
List 的内容、Card 卡片的内容配置同上
|
|
|
|
|
|
|
|
### Form 中静态展示
|
|
|
|
|
2021-01-07 23:35:03 +08:00
|
|
|
```schema: scope="body"
|
2020-07-28 10:03:53 +08:00
|
|
|
{
|
|
|
|
"type": "form",
|
|
|
|
"data": {
|
|
|
|
"color": "#108cee"
|
|
|
|
},
|
2021-06-07 10:09:55 +08:00
|
|
|
"body": [
|
2020-07-28 10:03:53 +08:00
|
|
|
{
|
|
|
|
"type": "static-color",
|
|
|
|
"name": "color",
|
|
|
|
"label": "颜色"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## 属性表
|
|
|
|
|
|
|
|
| 属性名 | 类型 | 默认值 | 说明 |
|
|
|
|
| ------------ | --------- | ------ | -------------------------------------------------------------------------------------- |
|
|
|
|
| type | `string` | | 如果在 Table、Card 和 List 中,为`"color"`;在 Form 中用作静态展示,为`"static-color"` |
|
|
|
|
| className | `string` | | 外层 CSS 类名 |
|
|
|
|
| value | `string` | | 显示的颜色值 |
|
|
|
|
| name | `string` | | 在其他组件中,时,用作变量映射 |
|
|
|
|
| defaultColor | `string` | `#ccc` | 默认颜色值 |
|
|
|
|
| showValue | `boolean` | `true` | 是否显示右边的颜色值 |
|