1. import React from 'react';
    2. import { Button } from 'antd';
    3. import FormRender, { useForm } from 'form-render';
    4. const schema = {
    5. type: 'object',
    6. displayType: 'row',
    7. properties: {
    8. aa: {
    9. title: '对象',
    10. type: 'object',
    11. properties: {
    12. input1: {
    13. title: '简单输入框',
    14. type: 'string',
    15. default: 'hello world',
    16. required: true,
    17. },
    18. check: {
    19. title: 'box',
    20. type: 'boolean',
    21. default: true,
    22. },
    23. select1: {
    24. title: '单选',
    25. type: 'string',
    26. enum: ['a', 'b', 'c'],
    27. enumNames: ['早', '中', '晚'],
    28. default: 'a',
    29. },
    30. },
    31. },
    32. },
    33. };
    34. // const schema = {
    35. // displayType: 'column',
    36. // type: 'object',
    37. // properties: {
    38. // input1: {
    39. // title: '简单输入框',
    40. // type: 'string',
    41. // required: true,
    42. // },
    43. // select1: {
    44. // title: '单选',
    45. // type: 'string',
    46. // enum: ['a', 'b', 'c'],
    47. // enumNames: ['早', '中', '晚'],
    48. // },
    49. // },
    50. // };
    51. const Demo = () => {
    52. const form = useForm();
    53. return <FormRender readOnly form={form} schema={schema} />;
    54. };
    55. export default Demo;