项目中需要点击按钮展现日期选择弹框,所已我用的open属性,通过button触发更改open为true||false;但是,不能点击空白使open属性为false,请问,有哪位大佬解决过次次问题
datePickerChange(date) {
const { datePickerOpen } = this.state;this.setState({ datePickerOpen: !datePickerOpen })
}
datePickerOpen() {
const { datePickerOpen } = this.state;this.setState({ datePickerOpen: !datePickerOpen })
<Button type="primary" icon="plus" onClick={() => this.datePickerOpen()}>增加对比时段</Button>
<DatePicker className={styles.datePicker} open={datePickerOpen} onChange={(date)=>this.datePickerChange(date)}
/>