我使用了来自react-date-picker
. 我需要在单击一次按钮时禁用整个日期控件和按钮本身。该按钮确实被禁用,但DatePicker组件没有。我尝试了以下但没有奏效。有正确的方法吗?
import DatePicker from 'react-date-picker';
...
...
this.state = {
disabledDate: false
}
...
...
...
noDateRememberButtonClick() {
this.setState({
disabledDate: true
});
}
render() {
return(
<div className="wrapper">
<div className="date-picker">
<DatePicker
onChange={this.dateOnChange}
value={this.state.boughtDate}
disabled={this.state.disabledDate} />
</div>
<button className="btn" onClick={this.noDateRememberButtonClick} disabled={this.state.disabledDate} type="button"> {BUTTON_LABEL}</button>
</div>
)}