twitter-bootstrap - 是否可以根据需要设置react-day-picker的输入字段?

标签 twitter-bootstrap reactjs react-day-picker

我的表单中有两个 DayPickerInput 字段,想将它们标记为必填字段,但不知道如何操作。有人可以帮忙吗?

        <FormGroup row>
            <Col md="4">
                <Label htmlFor="begin">Begin</Label>
            </Col>
            <Col xs="12" md="8">
                <DayPickerInput value={this.state.begin}
                                format={settings.formatDate} />
            </Col>
        </FormGroup>
        <FormGroup row>
            <Col md="4">
                <Label htmlFor="end">End</Label>
            </Col>
            <Col xs="12" md="8">
                <DayPickerInput value={this.state.end}
                                format={settings.formatDate} />
            </Col>
        </FormGroup>

更新:我尝试使用 inputProps:

<DayPickerInput inputProps={required} />

但出现错误:

ReferenceError: required is not defined

最佳答案

I tried with inputProps:

<DayPickerInput inputProps={required} /> 

but got error:

ReferenceError: required is not defined

这是如何将对象作为 Prop 传递:

<DayPickerInput 
   inputProps={
     { required: true }
   } 
/>

关于twitter-bootstrap - 是否可以根据需要设置react-day-picker的输入字段?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47691439/

相关文章:

html - 输入类型文件在 Bootstrap 模式中不起作用

html - 使用 Bootstrap 可切换选项卡创建 HTML 表单,内容不显示

css - Bootstrap 列被推到不同的宽度

html - Div 全高 - 无响应

css - Material-UI对话框字体覆盖

javascript - 跨 React 组件重用代码

javascript - ReactJs 调用 {this.functionName} 和 {this.functionName()} 有什么区别

reactjs - 如何使用 react-day-picker 发布正确的工作日

javascript - `DatePickerInput` "className"属性为 `&lt;input/>`

css - 如何将 css 文件导入组件 .jsx 文件