我的表单中有两个 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/