{...formItemLayout} 标签布局

{...formItemLayout}是reactjs中属性的写法{...props},formItemLayout标签布局,wrapperCol需要为输入控件设置布局样式时,和label 标签布局,通 <Col> 组件,设置 span offset 值,如{span: 3, offset: 12}

const formItemLayout = {
  labelCol: {
    xs: { span: 24 },
    sm: { span: 7 },
  },
  wrapperCol: {
    xs: { span: 24 },
    sm: { span: 12 },
    md: { span: 10 },
  },
};

<FormItem {...formItemLayout} label="标题">
  {getFieldDecorator('title', {
    rules: [
      {
        required: true,
        message: '请输入标题',
      },
    ],
  })(<Input placeholder="给目标起个名字" />)}
</FormItem>

.

posted @ 2018-10-05 21:25  每天都要进步一点点  阅读(3873)  评论(0编辑  收藏  举报