mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 22:36:31 +08:00
Merge branch '1.x-stable' of github.com:ant-design/ant-design into 1.x-stable
This commit is contained in:
commit
1830ad8208
@ -2,6 +2,7 @@ import React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import PureRenderMixin from 'react-addons-pure-render-mixin';
|
||||
import omit from 'object.omit';
|
||||
import warning from 'warning';
|
||||
|
||||
export default class Form extends React.Component {
|
||||
static defaultProps = {
|
||||
@ -19,6 +20,12 @@ export default class Form extends React.Component {
|
||||
onSubmit: React.PropTypes.func,
|
||||
}
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
warning(!props.form, 'It is unnessary to pass `form` to `Form` after antd@1.7.0.');
|
||||
}
|
||||
|
||||
shouldComponentUpdate(...args) {
|
||||
return PureRenderMixin.shouldComponentUpdate.apply(this, args);
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ let Demo = React.createClass({
|
||||
);
|
||||
});
|
||||
return (
|
||||
<Form horizontal>
|
||||
<Form horizontal form={this.props.form}>
|
||||
{formItems}
|
||||
<Form.Item wrapperCol={{ span: 18, offset: 6 }}>
|
||||
<Button onClick={this.add} style={{ marginRight: 8 }}>新增好朋友</Button>
|
||||
|
@ -39,7 +39,7 @@ let Demo = React.createClass({
|
||||
<div>
|
||||
<Button type="primary" onClick={this.showModal}>点击有惊喜</Button>
|
||||
<Modal title="登录" visible={this.state.visible} onOk={this.handleSubmit} onCancel={this.hideModal}>
|
||||
<Form horizontal>
|
||||
<Form horizontal form={this.props.form}>
|
||||
<FormItem
|
||||
{...formItemLayout}
|
||||
label="用户名"
|
||||
|
@ -109,7 +109,7 @@ let BasicDemo = React.createClass({
|
||||
wrapperCol: { span: 12 },
|
||||
};
|
||||
return (
|
||||
<Form horizontal>
|
||||
<Form horizontal form={this.props.form}>
|
||||
<FormItem
|
||||
{...formItemLayout}
|
||||
label="用户名"
|
||||
|
@ -140,7 +140,7 @@ let Demo = React.createClass({
|
||||
};
|
||||
return (
|
||||
<div>
|
||||
<Form horizontal>
|
||||
<Form horizontal form={this.props.form}>
|
||||
<Row>
|
||||
<Col span="18">
|
||||
<FormItem
|
||||
|
@ -107,7 +107,7 @@ let Demo = React.createClass({
|
||||
wrapperCol: { span: 12 },
|
||||
};
|
||||
return (
|
||||
<Form horizontal>
|
||||
<Form horizontal form={this.props.form}>
|
||||
<FormItem
|
||||
{...formItemLayout}
|
||||
label="国籍"
|
||||
|
@ -38,6 +38,7 @@ english: Form
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
|-----------|------------------------------------------|------------|-------|
|
||||
| form | 经 `Form.create()` 包装过的组件会自带 `this.props.form` 属性,直接传给 Form 即可。1.7.0 之后无需设置 | object | 无 |
|
||||
| horizontal | 水平排列布局 | boolean | false |
|
||||
| inline | 行内排列布局 | boolean | false |
|
||||
| onSubmit | 数据验证成功后回调事件 | Function(e:Event) | |
|
||||
|
Loading…
Reference in New Issue
Block a user