fix: 修复 property 组件在初始无数据时报错问题 (#2628)

This commit is contained in:
吴多益 2021-09-29 15:55:01 +08:00 committed by GitHub
parent 082edb6257
commit 2fdbf5d220
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -196,7 +196,7 @@ order: 60
}, },
"body": { "body": {
"type": "property", "type": "property",
"source": "items" "source": "${items}"
} }
} }
``` ```

View File

@ -120,9 +120,10 @@ export default class Property extends React.Component<PropertyProps, object> {
prepareRows() { prepareRows() {
const {column = 3, items, source, data} = this.props; const {column = 3, items, source, data} = this.props;
const propertyItems = items const propertyItems =
? items (items
: (resolveVariable(source, data) as Array<PropertyItem>); ? items
: (resolveVariable(source, data) as Array<PropertyItem>)) || [];
const rows: PropertyContent[][] = []; const rows: PropertyContent[][] = [];