Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

多列栅格式的表单排列方式布局异常 #4271

Closed
kqdjacky opened this issue Dec 16, 2016 · 5 comments
Closed

多列栅格式的表单排列方式布局异常 #4271

kqdjacky opened this issue Dec 16, 2016 · 5 comments

Comments

@kqdjacky
Copy link

kqdjacky commented Dec 16, 2016

发生问题的环境是:

  • antd 版本: 2.5.2
  • 操作系统及其版本: Mac OS X, Windows 7
  • 浏览器及其版本: Firefox 50.1.0

您做了什么?请提供尽可能详细的重现步骤。

在Modal里面使用Form, Row, Col.
代码如下:

    <Modal {...modalOpts}>
        <Form horizontal>
          <Row>
            <Col span={12}>
              <FormItem label="登录名:" hasFeedback {...formItemLayout}>
                {getFieldDecorator('login_name', {
                  initialValue: item.login_name,
                  rules: [
                    { required: true, message: '登录名未填写' },
                  ],
                })(
                  <Input type="text" />
                )}
              </FormItem>
            </Col>
            <Col span={12}>
              <FormItem label="姓名:" hasFeedback {...formItemLayout}>
                {getFieldDecorator('name', {
                  initialValue: item.name
                })(
                  <Input type="text" />
                )}
              </FormItem>
            </Col>
            <Col span={12}>
              {password()}
            </Col>
            <Col span={12}>
              <FormItem label="邮箱:" hasFeedback {...formItemLayout}>
                {
                  getFieldDecorator('email', {
                    initialValue: item.email
                  })(
                    <Input type='text' />
                  )
                }
              </FormItem>
            </Col>
            <Col span={12}>
              <FormItem label="电话" hasFeedback {...formItemLayout}>
                {
                  getFieldDecorator('phone', {
                    initialValue: item.phone
                  })(
                    <Input type='text' />
                  )
                }
              </FormItem>
            </Col>
            <Col span={12}>
              <FormItem label='移动电话' hasFeedback {...formItemLayout}>
                {
                  getFieldDecorator('telephone', {
                    initialValue: item.telephone
                  })(
                    <Input type='text' />
                  )
                }
              </FormItem>
            </Col>
          </Row>
        </Form>
    </Modal>

您期待的结果是:

一行显示两个formitem.

实际上的结果是:

default

可重现的在线演示

http://codepen.io/kqdjacky/pen/Ypdybe?editors=0010

@benjycui
Copy link
Contributor

Please provide a re-producible demo: http://codepen.io/benjycui/pen/KgPZrE?editors=001

Please learn how to write readable Markdown, and it's a good habit to preview your comment before submitting.

@kqdjacky
Copy link
Author

kqdjacky commented Dec 16, 2016

重现情况请看这里:
http://codepen.io/kqdjacky/pen/Ypdybe?editors=0010

default

@kqdjacky
Copy link
Author

BTW, 在safari上正常显示的

@afc163 afc163 closed this as completed in 48de73b Dec 16, 2016
@afc163
Copy link
Member

afc163 commented Dec 16, 2016

感谢详尽的反馈,很有帮助。

@wangking873
Copy link

最近一次antd升级后 我也出现上面问题 应该是高度导致的
自己增加了高度限制才正常
const formItemLayout = {
labelCol: { span: 8 },
wrapperCol: { span: 16 },
style:{ maxHeight:'32px', overflow: 'hidden' },
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants