mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-30 02:48:55 +08:00
Merge pull request #4942 from nwind/feat-property-autovar
feat: Property 的 title 等属性支持自动变量解析 Closes #4900
This commit is contained in:
commit
da2469c1ee
@ -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