贴进来的代码:运行 card style 的官方实例,ok。 把官方实例注释掉,然后填入「官方实例生成的 schema」,控制台就报错了。(Uncaught TypeError: Cannot read property 'x-component' of undefined)
看起来另外几个 list 组件也有这个问题,一时忙没时间研究代码题 pr,作者帮忙看看吧。谢谢~
`import React from 'react';
import ReactDOM from 'react-dom';
import {
SchemaForm,
Field,
FormButtonGroup,
Submit,
Reset,
FormItemGrid,
FormCard,
FormPath,
FormBlock,
FormLayout,
createFormActions
} from '@uform/antd';
import { Button } from 'antd';
import Printer from '@uform/printer';
import 'antd/dist/antd.css';
const App = () => (
<SchemaForm
schema={{
'type': 'object',
'properties': {
'array': {
'type': 'array',
'x-props': {
'title': '这是卡片标题',
'renderAddition': '这是定制的添加文案',
'renderRemove': '这是定制的删除文案'
},
'x-component': 'cards',
'maxItems': 3,
'properties': {},
'items': {
'type': 'object',
'properties': {
'UFORM_NO_NAME_FIELD_$0': {
'type': 'object',
'x-props': {
'labelCol': 6,
'wrapperCol': 8
},
'x-component': 'layout',
'properties': {
'aa': {
'type': 'string',
'title': '字段1',
'properties': {}
},
'bb': {
'type': 'string',
'title': '字段2',
'properties': {}
},
'cc': {
'type': 'string',
'title': '字段3',
'properties': {}
},
'dd': {
'type': 'string',
'title': '字段5',
'properties': {}
},
'ee': {
'type': 'string',
'title': '字段6',
'properties': {}
},
'ff': {
'type': 'string',
'title': '字段7',
'properties': {}
},
'gg': {
'type': 'daterange',
'title': '字段8',
'properties': {}
}
}
}
}
}
}
}
}}
>
{/<Field name="array" maxItems={3} type="array" x-component="cards"/}
{/* x-props={{/}
{/ title: '这是卡片标题',/}
{/ renderAddition: '这是定制的添加文案',/}
{/ renderRemove: '这是定制的删除文案'/}
{/ }}>/}
{/ /}
{/ /}
{/ <Field*/}
{/* name="aa"/}
{/ type="string"/}
{/ description="hello world"/}
{/ title="字段1"/}
{/ />/}
{/ /}
{/ /}
{/ /}
{/ /}
{/ /}
{/ /}
{/ /}
{/ /}
{/ /}
{/*/}
);
export default App;
`