mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
feat: Property 的 title 等属性支持自动变量解析 Closes #4900
This commit is contained in:
parent
816966c33d
commit
1bf4286bcb
@ -165,6 +165,7 @@ order: 60
|
||||
{
|
||||
"type": "page",
|
||||
"data": {
|
||||
"title": "title1",
|
||||
"items": [
|
||||
{
|
||||
"label": "cpu",
|
||||
@ -196,6 +197,7 @@ order: 60
|
||||
},
|
||||
"body": {
|
||||
"type": "property",
|
||||
"title": "${title}",
|
||||
"source": "${items}"
|
||||
}
|
||||
}
|
||||
@ -372,6 +374,8 @@ items 里的属性还支持 `visibleOn` 和 `hiddenOn` 表达式,能隐藏部
|
||||
| column | `number` | 3 | 每行几列 |
|
||||
| mode | `string` | 'table' | 显示模式,目前只有 'table' 和 'simple' |
|
||||
| separator | `string` | ',' | 'simple' 模式下属性名和值之间的分隔符 |
|
||||
| title | `string` | | 标题 |
|
||||
| source | `string` | | 数据源 |
|
||||
| items[].label | `SchemaTpl` | | 属性名 |
|
||||
| items[].content | `SchemaTpl` | | 属性值 |
|
||||
| items[].span | `SchemaTpl` | | 属性值跨几列 |
|
||||
|
@ -119,14 +119,7 @@ export default class Property extends React.Component<PropertyProps, object> {
|
||||
*/
|
||||
prepareRows() {
|
||||
const {column = 3, items, source, data} = this.props;
|
||||
const propertyItems =
|
||||
(items
|
||||
? items
|
||||
: (resolveVariableAndFilter(
|
||||
source,
|
||||
data,
|
||||
'| raw'
|
||||
) as Array<PropertyItem>)) || [];
|
||||
const propertyItems = items ? items : source || [];
|
||||
|
||||
const rows: PropertyContent[][] = [];
|
||||
|
||||
@ -246,6 +239,7 @@ export default class Property extends React.Component<PropertyProps, object> {
|
||||
}
|
||||
|
||||
@Renderer({
|
||||
type: 'property'
|
||||
type: 'property',
|
||||
autoVar: true
|
||||
})
|
||||
export class PropertyRenderer extends Property {}
|
||||
|
Loading…
Reference in New Issue
Block a user