Form 表单

表单。

何时使用

代码演示

基本使用

表单。

Form表单 - 图1

  1. import React from 'react';
  2. import ReactDOM from 'react-dom';
  3. import {
  4. Form,
  5. TextField,
  6. Password,
  7. NumberField,
  8. EmailField,
  9. UrlField,
  10. DatePicker,
  11. Select,
  12. SelectBox,
  13. Button,
  14. Menu,
  15. Dropdown,
  16. Icon,
  17. } from 'choerodon-ui/pro';
  18. const { Option } = Select;
  19. function passwordValidator(value, name, form) {
  20. if (value !== form.getField('password').getValue()) {
  21. return '您两次输入的密码不一致,请重新输入';
  22. }
  23. return true;
  24. }
  25. function validationRenderer(error, props) {
  26. if (error.ruleName === 'valueMissing' && props.name === 'password') {
  27. return <span style={{ color: 'blue' }}>{error.validationMessage}(自定义)</span>;
  28. }
  29. }
  30. const menu = (
  31. <Menu>
  32. <Menu.Item>
  33. <a target="_blank" rel="noopener noreferrer" href="https://choerodon.io/">
  34. 1st menu item
  35. </a>
  36. </Menu.Item>
  37. <Menu.Item>
  38. <a target="_blank" rel="noopener noreferrer" href="https://choerodon.com.cn/">
  39. 2nd menu item
  40. </a>
  41. </Menu.Item>
  42. <Menu.Item>
  43. <a target="_blank" rel="noopener noreferrer" href="https://github.com/choerodon/choerodon-ui">
  44. 3rd menu item
  45. </a>
  46. </Menu.Item>
  47. </Menu>
  48. );
  49. const dropdown = (
  50. <Dropdown overlay={menu}>

设置冒号模式

设置冒号模式

Form表单 - 图2

  1. import React from 'react';
  2. import ReactDOM from 'react-dom';
  3. import {
  4. Form,
  5. TextField,
  6. Password,
  7. NumberField,
  8. EmailField,
  9. UrlField,
  10. DatePicker,
  11. Select,
  12. SelectBox,
  13. Button,
  14. Menu,
  15. Dropdown,
  16. Icon,
  17. } from 'choerodon-ui/pro';
  18. const { Option } = Select;
  19. function passwordValidator(value, name, form) {
  20. if (value !== form.getField('password').getValue()) {
  21. return '您两次输入的密码不一致,请重新输入';
  22. }
  23. return true;
  24. }
  25. function validationRenderer(error, props) {
  26. if (error.ruleName === 'valueMissing' && props.name === 'password') {
  27. return <span style={{ color: 'blue' }}>{error.validationMessage}(自定义)</span>;
  28. }
  29. }
  30. const menu = (
  31. <Menu>
  32. <Menu.Item>
  33. <a target="_blank" rel="noopener noreferrer" href="https://choerodon.io/">
  34. 1st menu item
  35. </a>
  36. </Menu.Item>
  37. <Menu.Item>
  38. <a target="_blank" rel="noopener noreferrer" href="https://choerodon.com.cn/">
  39. 2nd menu item
  40. </a>
  41. </Menu.Item>
  42. <Menu.Item>
  43. <a target="_blank" rel="noopener noreferrer" href="https://github.com/choerodon/choerodon-ui">
  44. 3rd menu item
  45. </a>
  46. </Menu.Item>
  47. </Menu>
  48. );
  49. const dropdown = (
  50. <Dropdown overlay={menu}>

数据源

表单绑定数据源。

Form表单 - 图3

  1. import React from 'react';
  2. import ReactDOM from 'react-dom';
  3. import {
  4. DataSet,
  5. Form,
  6. TextField,
  7. NumberField,
  8. Password,
  9. EmailField,
  10. UrlField,
  11. DatePicker,
  12. Select,
  13. SelectBox,
  14. Switch,
  15. Lov,
  16. Button,
  17. } from 'choerodon-ui/pro';
  18. const { Option } = Select;
  19. function passwordValidator(value, name, record) {
  20. if (value !== record.get('password')) {
  21. return '您两次输入的密码不一致,请重新输入';
  22. }
  23. return true;
  24. }
  25. const defaultValidationMessages = {
  26. valueMissing: '请输入{label}。(自定义)',
  27. };
  28. class App extends React.Component {
  29. ds = new DataSet({
  30. fields: [
  31. {
  32. name: 'phone',
  33. type: 'string',
  34. label: '手机号',
  35. labelWidth: 150,
  36. required: true,
  37. pattern: '^1[3-9]\\d{9}$',
  38. },
  39. {
  40. name: 'password',
  41. type: 'string',
  42. label: '密码',
  43. required: true,
  44. defaultValidationMessages,
  45. },
  46. {
  47. name: 'confirmPassword',
  48. type: 'string',
  49. label: '确认密码',
  50. required: true,
  51. validator: passwordValidator,
  52. },
  53. {
  54. name: 'age',
  55. type: 'number',

数据源记录

表单绑定数据源某条记录。

Form表单 - 图4

  1. import React from 'react';
  2. import ReactDOM from 'react-dom';
  3. import { DataSet, Form, TextField, NumberField, Password, EmailField, UrlField, DatePicker, Select, SelectBox, Lov, Button } from 'choerodon-ui/pro';
  4. const { Option } = Select;
  5. function passwordValidator(value, name, record) {
  6. if (value !== record.get('password')) {
  7. return '您两次输入的密码不一致,请重新输入';
  8. }
  9. return true;
  10. }
  11. class App extends React.Component {
  12. ds = new DataSet({
  13. autoCreate: true,
  14. fields: [
  15. { name: 'phone', type: 'string', label: '手机号', required: true },
  16. { name: 'password', type: 'string', label: '密码', required: true },
  17. { name: 'confirmPassword', type: 'string', label: '确认密码', required: true, validator: passwordValidator },
  18. { name: 'age', type: 'number', label: '年龄', required: true, help: '我们需要确定你的年龄' },
  19. { name: 'sex', type: 'string', label: '性别', required: true },
  20. { name: 'language', type: 'string', label: '语言', required: true, help: '超过两行的帮助信息超过两行的帮助信息超过两行的帮助信息' },
  21. { name: 'email', type: 'email', label: '邮箱', required: true },
  22. { name: 'homepage', type: 'url', label: '个人主页', required: true },
  23. { name: 'birth', type: 'date', label: '生日', required: true },
  24. { name: 'code', type: 'object', label: '代码描述', lovCode: 'LOV_CODE' },
  25. ],
  26. });
  27. render() {
  28. return (
  29. <Form record={this.ds.current} style={{ width: '4rem' }}>
  30. <TextField pattern="1[3-9]\d{9}" name="phone" />
  31. <Password name="password" />
  32. <Password name="confirmPassword" />
  33. <NumberField name="age" min={18} step={1} addonAfter="周岁" showHelp="tooltip" />
  34. <SelectBox name="sex">
  35. <Option value="M">男</Option>
  36. <Option value="F">女</Option>
  37. </SelectBox>
  38. <Select name="language">
  39. <Option value="zh-cn">简体中文</Option>
  40. <Option value="en-us">英语(美国)</Option>
  41. <Option value="ja-jp">日本語</Option>
  42. </Select>
  43. <EmailField name="email" />
  44. <UrlField name="homepage" />
  45. <DatePicker name="birth" />
  46. <Lov name="code" />
  47. <div>
  48. <Button type="submit">注册</Button>
  49. <Button type="reset" style={{ marginLeft: 8 }}>重置</Button>
  50. </div>
  51. </Form>
  52. );
  53. }

布局

布局。

Form表单 - 图5

  1. import React from 'react';
  2. import ReactDOM from 'react-dom';
  3. import { Form, TextField, Password, NumberField, EmailField, UrlField, DatePicker, Select, SelectBox, TextArea, Button } from 'choerodon-ui/pro';
  4. const { Option } = Select;
  5. function passwordValidator(value, name, form) {
  6. if (value !== form.getField('password').getValue()) {
  7. return '您两次输入的密码不一致,请重新输入';
  8. }
  9. return true;
  10. }
  11. ReactDOM.render(
  12. <Form labelWidth={[60, 70, 50]} columns={3}>
  13. <TextField colSpan={3} label="手机号" pattern="1[3-9]\d{9}" name="phone" required />
  14. <Password label="密码" name="password" required />
  15. <NumberField rowSpan={2} label="年龄" name="age" min={18} step={1} required addonAfter="周岁" />
  16. <Password label="确认密码" name="confirmPassword" required validator={passwordValidator} />
  17. <SelectBox colSpan={2} label="性别" name="sex" required>
  18. <Option value="M">男</Option>
  19. <Option value="F">女</Option>
  20. </SelectBox>
  21. <Select label="语言" name="language" required>
  22. <Option value="zh-cn">简体中文</Option>
  23. <Option value="en-us">英语(美国)</Option>
  24. <Option value="ja-jp">日本語</Option>
  25. </Select>
  26. <EmailField label="邮箱" name="email" />
  27. <TextArea rowSpan={2} colSpan={2} label="简介" name="description" required style={{ height: 80 }} help="请输入100~300个字符请输入100~300个字符请输入100~300个字符" />
  28. <UrlField label={<span>个人主页</span>} name="homepage" required help="请输入你的个人主页,如Github Pages个人博客" showHelp="tooltip" />
  29. <DatePicker label="生日" name="birth" required />
  30. <div newLine colSpan={3}>
  31. <Button type="submit">注册</Button>
  32. <Button type="reset" style={{ marginLeft: 8 }}>重置</Button>
  33. </div>
  34. </Form>,
  35. document.getElementById('container')
  36. );

垂直布局

垂直布局。

Form表单 - 图6

  1. import React from 'react';
  2. import ReactDOM from 'react-dom';
  3. import { Form, TextField, Password, NumberField, EmailField, UrlField, DatePicker, Select, SelectBox, CodeArea, Button } from 'choerodon-ui/pro';
  4. const { Option } = Select;
  5. function passwordValidator(value, name, form) {
  6. if (value !== form.getField('password').getValue()) {
  7. return '您两次输入的密码不一致,请重新输入';
  8. }
  9. return true;
  10. }
  11. ReactDOM.render(
  12. <Form labelLayout="vertical" columns={3}>
  13. <TextField colSpan={3} label="手机号" pattern="1[3-9]\d{9}" name="phone" required />
  14. <Password label="密码" name="password" required />
  15. <Password label="确认密码" name="confirmPassword" required validator={passwordValidator} help="请输入与左侧相同的密码" />
  16. <NumberField rowSpan={2} label="年龄" name="age" min={18} step={1} required />
  17. <SelectBox label="性别" name="sex" required>
  18. <Option value="M">男</Option>
  19. <Option value="F">女</Option>
  20. </SelectBox>
  21. <Select label="语言" name="language" required>
  22. <Option value="zh-cn">简体中文</Option>
  23. <Option value="en-us">英语(美国)</Option>
  24. <Option value="ja-jp">日本語</Option>
  25. </Select>
  26. <EmailField label="邮箱" name="email" />
  27. <CodeArea rowSpan={2} colSpan={2} rows={4} label="简介" name="description" required />
  28. <UrlField label="个人主页" name="homepage" required />
  29. <DatePicker label="生日" name="birth" required />
  30. <div newLine colSpan={3}>
  31. <Button type="submit">注册</Button>
  32. <Button type="reset" style={{ marginLeft: 8 }}>重置</Button>
  33. </div>
  34. </Form>,
  35. document.getElementById('container')
  36. );

占位符显示标签

占位符显示标签。

Form表单 - 图7

  1. import React from 'react';
  2. import ReactDOM from 'react-dom';
  3. import { Form, TextField, Password, NumberField, EmailField, UrlField, DatePicker, Select, SelectBox, TextArea, Button } from 'choerodon-ui/pro';
  4. const { Option } = Select;
  5. function passwordValidator(value, name, form) {
  6. if (value !== form.getField('password').getValue()) {
  7. return '您两次输入的密码不一致,请重新输入';
  8. }
  9. return true;
  10. }
  11. ReactDOM.render(
  12. <Form labelLayout="placeholder" columns={3}>
  13. <TextField colSpan={3} label="手机号" pattern="1[3-9]\d{9}" name="phone" required />
  14. <Password label="密码" name="password" required />
  15. <Password label="确认密码" name="confirmPassword" required validator={passwordValidator} help="请输入与左侧相同的密码" />
  16. <NumberField rowSpan={2} label="年龄" name="age" min={18} step={1} required />
  17. <SelectBox label="性别" name="sex" required>
  18. <Option value="M">男</Option>
  19. <Option value="F">女</Option>
  20. </SelectBox>
  21. <Select label="语言" name="language" required>
  22. <Option value="zh-cn">简体中文</Option>
  23. <Option value="en-us">英语(美国)</Option>
  24. <Option value="ja-jp">日本語</Option>
  25. </Select>
  26. <EmailField label="邮箱" name="email" />
  27. <TextArea rowSpan={2} colSpan={2} label="简介" name="description" required style={{ height: 80 }} />
  28. <UrlField label="个人主页" name="homepage" required />
  29. <DatePicker label="生日" name="birth" required />
  30. <div newLine colSpan={3}>
  31. <Button type="submit">注册</Button>
  32. <Button type="reset" style={{ marginLeft: 8 }}>重置</Button>
  33. </div>
  34. </Form>,
  35. document.getElementById('container')
  36. );

浮动标签

浮动标签。

Form表单 - 图8

  1. import React from 'react';
  2. import ReactDOM from 'react-dom';
  3. import {
  4. Form,
  5. CheckBox,
  6. TextField,
  7. Password,
  8. NumberField,
  9. EmailField,
  10. UrlField,
  11. DatePicker,
  12. Range,
  13. Select,
  14. SelectBox,
  15. Switch,
  16. TextArea,
  17. Button,
  18. Icon,
  19. } from 'choerodon-ui/pro';
  20. const { Option } = Select;
  21. function passwordValidator(value, name, form) {
  22. if (value !== form.getField('password').getValue()) {
  23. return '您两次输入的密码不一致,请重新输入';
  24. }
  25. return true;
  26. }
  27. ReactDOM.render(
  28. <Form labelLayout="float" columns={3} header="Float Label">
  29. <TextField
  30. colSpan={3}
  31. label="手机号"
  32. pattern="1[3-9]\d{9}"
  33. name="phone"
  34. required
  35. placeholder="请输入手机号"
  36. addonBefore="+86"
  37. addonAfter="中国大陆"
  38. />
  39. <Password label="密码" name="password" required />
  40. <Password
  41. label="确认密码"
  42. name="confirmPassword"
  43. required
  44. validator={passwordValidator}
  45. help="请输入与左侧相同的密码"
  46. disabled
  47. />
  48. <NumberField rowSpan={2} label="年龄" name="age" min={18} step={1} required />
  49. <SelectBox label="性别" name="sex" required>
  50. <Option value="M">男</Option>
  51. <Option value="F">女</Option>
  52. </SelectBox>

表单头

表单头。

Form表单 - 图9

  1. import React from 'react';
  2. import ReactDOM from 'react-dom';
  3. import { Form, TextField, Password, NumberField, EmailField, UrlField, DatePicker, Select, SelectBox, Button } from 'choerodon-ui/pro';
  4. const { Option } = Select;
  5. function passwordValidator(value, name, form) {
  6. if (value !== form.getField('password').getValue()) {
  7. return '您两次输入的密码不一致,请重新输入';
  8. }
  9. return true;
  10. }
  11. ReactDOM.render(
  12. <Form header="Custom Header">
  13. <TextField label="手机号" pattern="1[3-9]\d{9}" name="phone" required clearButton />
  14. <Password label="密码" name="password" required />
  15. <Password label="确认密码" name="confirmPassword" required validator={passwordValidator} />
  16. <NumberField label="年龄" name="age" min={18} step={1} required />
  17. <SelectBox label="性别" name="sex" required>
  18. <Option value="M">男</Option>
  19. <Option value="F">女</Option>
  20. </SelectBox>
  21. <Select label="语言" name="language" required>
  22. <Option value="zh-cn">简体中文</Option>
  23. <Option value="en-us">英语(美国)</Option>
  24. <Option value="ja-jp">日本語</Option>
  25. </Select>
  26. <EmailField label="邮箱" name="email" required />
  27. <UrlField label="个人主页" name="homepage" required />
  28. <DatePicker label="生日" name="birth" required />
  29. <div>
  30. <Button type="submit">注册</Button>
  31. <Button type="reset" style={{ marginLeft: 8 }}>重置</Button>
  32. </div>
  33. </Form>,
  34. document.getElementById('container')
  35. );

响应式

响应式。

Form表单 - 图10

  1. import React from 'react';
  2. import ReactDOM from 'react-dom';
  3. import {
  4. Form,
  5. TextField,
  6. Password,
  7. NumberField,
  8. EmailField,
  9. UrlField,
  10. DatePicker,
  11. Select,
  12. SelectBox,
  13. Button,
  14. } from 'choerodon-ui/pro';
  15. const { Option } = Select;
  16. ReactDOM.render(
  17. <Form
  18. columns={{ xs: 1, sm: 1, md: 2, lg: 3, xl: 3, xxl: 4 }}
  19. labelLayout={{ xs: 'vertical' }}
  20. >
  21. <TextField
  22. label="手机号"
  23. pattern="1[3-9]\d{9}"
  24. name="phone"
  25. required
  26. clearButton
  27. addonBefore="+86"
  28. addonAfter="中国大陆"
  29. />
  30. <Password label="密码" name="password" required />
  31. <Password
  32. label="确认密码"
  33. name="confirmPassword"
  34. required

禁用

表单。

Form表单 - 图11

  1. import React from 'react';
  2. import ReactDOM from 'react-dom';
  3. import { Form, TextField, Password, NumberField, EmailField, UrlField, DatePicker, Select, SelectBox, Button, Menu, Dropdown, Icon } from 'choerodon-ui/pro';
  4. const { Option } = Select;
  5. function passwordValidator(value, name, form) {
  6. if (value !== form.getField('password').getValue()) {
  7. return '您两次输入的密码不一致,请重新输入';
  8. }
  9. return true;
  10. }
  11. const menu = (
  12. <Menu>
  13. <Menu.Item>
  14. <a target="_blank" rel="noopener noreferrer" href="https://choerodon.io/">1st menu item</a>
  15. </Menu.Item>
  16. <Menu.Item>
  17. <a target="_blank" rel="noopener noreferrer" href="https://choerodon.com.cn/">2nd menu item</a>
  18. </Menu.Item>
  19. <Menu.Item>
  20. <a target="_blank" rel="noopener noreferrer" href="https://github.com/choerodon/choerodon-ui">3rd menu item</a>
  21. </Menu.Item>
  22. </Menu>
  23. );
  24. const dropdown = (
  25. <Dropdown overlay={menu}>
  26. <Button funcType="flat" size="small">
  27. Click me <Icon type="arrow_drop_down" />
  28. </Button>
  29. </Dropdown>
  30. );
  31. ReactDOM.render(
  32. <Form disabled style={{ width: '4rem' }}>
  33. <TextField label="手机号" pattern="1[3-9]\d{9}" name="phone" required clearButton addonBefore="+86" addonAfter="中国大陆" />
  34. <Password label="密码" name="password" required />
  35. <Password label="确认密码" name="confirmPassword" required validator={passwordValidator} help="请输入与上方相同的密码" showHelp="tooltip" />
  36. <NumberField label="年龄" name="age" min={18} step={1} required help="我们需要确定你的年龄" addonAfter="周岁" />
  37. <SelectBox label="性别" name="sex" required>
  38. <Option value="M">男</Option>
  39. <Option value="F">女</Option>
  40. </SelectBox>
  41. <Select label="语言" name="language" required help="超过两行的帮助信息超过两行的帮助信息超过两行的帮助信息">
  42. <Option value="zh-cn">简体中文</Option>
  43. <Option value="en-us">英语(美国)</Option>
  44. <Option value="ja-jp">日本語</Option>
  45. </Select>
  46. <EmailField label="邮箱" name="email" required addonAfter={dropdown} />
  47. <UrlField label="个人主页" name="homepage" required addonBefore="Http://" />
  48. <DatePicker label="生日" name="birth" required />
  49. <Form>
  50. <div>
  51. <Button type="submit">注册</Button>

显示原始值

显示原始值。

Form表单 - 图12

  1. import React from 'react';
  2. import ReactDOM from 'react-dom';
  3. import {
  4. DataSet,
  5. Form,
  6. TextField,
  7. NumberField,
  8. Password,
  9. EmailField,
  10. UrlField,
  11. DatePicker,
  12. Select,
  13. SelectBox,
  14. Switch,
  15. Lov,
  16. Button,
  17. Row,
  18. Col,
  19. } from 'choerodon-ui/pro';
  20. const { Option } = Select;
  21. function passwordValidator(value, name, record) {
  22. if (value !== record.get('password')) {
  23. return '您两次输入的密码不一致,请重新输入';
  24. }
  25. return true;
  26. }
  27. class App extends React.Component {
  28. ds = new DataSet({
  29. data: [
  30. {
  31. phone: 1800000000,
  32. age: 18,
  33. sex: 'F',
  34. language: 'zh-cn',
  35. email: 'xxx@choerodon.io',
  36. homepage: 'https://choerodon.io',
  37. birth: '1984-11-22',
  38. code: 'HR.EMPLOYEE_GENDER',
  39. frozen: 'true',
  40. },
  41. ],
  42. fields: [
  43. {
  44. name: 'phone',
  45. type: 'string',
  46. label: '手机号',
  47. required: true,
  48. pattern: '^1[3-9]\\d{9}$',
  49. }, // /^1[3-9]\d{9}$/
  50. { name: 'password', type: 'string', label: '密码', required: true },
  51. {
  52. name: 'confirmPassword',
  53. type: 'string',
  54. label: '确认密码',
  55. required: true,
  56. validator: passwordValidator,

Modal中使用浮动标签

Modal中使用浮动标签Form。

Form表单 - 图13

  1. import React from 'react';
  2. import ReactDOM from 'react-dom';
  3. import {
  4. Form,
  5. CheckBox,
  6. TextField,
  7. Password,
  8. NumberField,
  9. EmailField,
  10. UrlField,
  11. DatePicker,
  12. Range,
  13. Select,
  14. SelectBox,
  15. Switch,
  16. TextArea,
  17. Button,
  18. Modal,
  19. } from 'choerodon-ui/pro';
  20. const { Option } = Select;
  21. function passwordValidator(value, name, form) {
  22. if (value !== form.getField('password').getValue()) {
  23. return '您两次输入的密码不一致,请重新输入';
  24. }
  25. return true;
  26. }

虚拟分组

虚拟分组

Form表单 - 图14

  1. import React from 'react';
  2. import ReactDOM from 'react-dom';
  3. import { Form, TextField, Button } from 'choerodon-ui/pro';
  4. const { FormVirtualGroup } = Form;
  5. class App extends React.Component {
  6. state = {
  7. showGroup: true,
  8. showGroup2: true,
  9. };
  10. toggleShow = () => {
  11. this.setState((prevState) => ({
  12. showGroup: !prevState.showGroup,
  13. }));
  14. };
  15. toggleShow2 = () => {
  16. this.setState((prevState) => ({
  17. showGroup2: !prevState.showGroup2,
  18. }));
  19. };
  20. render() {
  21. const { showGroup, showGroup2 } = this.state;
  22. return (
  23. <Form id="basic" style={{ width: '4rem' }}>
  24. <TextField
  25. label="手机号"
  26. labelWidth={150}
  27. pattern="1[3-9]\d{9}"
  28. name="phone"
  29. required
  30. clearButton
  31. addonBefore="+86"
  32. addonAfter="中国大陆"
  33. />
  34. {showGroup && (
  35. <FormVirtualGroup className="virtual-group">
  36. <TextField label="姓名1" />
  37. <TextField label="姓名2" />
  38. {showGroup2 && (
  39. <FormVirtualGroup className="virtual-group2">
  40. <TextField label="姓名3" />

API

参数说明类型默认值
action表单提交请求地址,当设置了 dataSet 时,该属性无作用string
method表单提交的 HTTP Method,可选值 GET | POSTstringPOST
target表单提交的目标,当表单设置了设置 target 且没有 dataSet 时作浏览器默认提交,否则作 Ajax 提交string
processParamsAjax 提交时的参数回调(event) => object
useColon是否使用冒号,当开启时会在所有的 label 后面加上冒号,并且必填的*号会被移到最前方booleanfalse
excludeUseColonTagList不使用冒号的标签的列表,当为自定义组件的时候,需要设置 displayName 作为标签名string[][‘div’, ‘button’, ‘Button’]
labelWidth内部控件的标签宽度。如果为数组则分别对应每列的标签宽度。数组长度不够列数,以默认值补全,响应式参考Responsivenumber| number[] | object100
labelAlign标签文字对齐方式,只在 labelLayout 为 horizontal 时起作用,可选值:left | center | right,响应式参考Responsivestring | objectright
labelLayout标签位置,可选值 horizontal | vertical | placeholder | float | none,响应式参考Responsivestring | objecthorizontal
dataIndex对照 record 在 DataSet 中的 indexnumberds.currentIndex
record对照 record,优先级高于 dataSet 和 dataIndexRecord
columns列数,响应式参考Responsivenumber | object1
pristine显示原始值booleanfalse
onSubmit提交回调Function
onReset重置回调Function
onSuccess提交成功回调Function
onError提交失败回调Function

更多属性请参考 DataSetComponent

Form.FormVirtualGroup

当需要对 Form 的一些表单控件进行分组控制的时候可以使用,例如统一控制某些表单控件的显隐,此外,使用FormVirtualGroup可以统一对表单控件进行属性注入,例如统一的className等.注意,FormVirtualGroup组件本身不会产生实际的dom结果,其结果与去掉FormVirtualGroup然后将显隐控制等逐一写入表单控件中的写法完全一致,

Form Layout

Form 子元素属性

参数说明类型默认值
rowSpan表单下控件跨越的行数number1
colSpan表单下控件跨越的列数number1
newLine另起新行boolean
label标签string | ReactNode
name字段名。可获取 DataSet 的字段属性,如 label,require 等,一般用于控件外需要嵌套其他元素时使用。string
labelWidth标签宽度。同列控件中标签宽度取最大设定值。子元素的 labelWidth 无法响应式。number

Form Responsive

响应式可设置参数 columns | labelWidth | labelAlign | labelLayout 为一个键值对。

键值可参考 Responsive BreakPoints