当我在Dropdown组件中选择一个Item时,我希望onChange事件触发。但是,即使我点击其他地方,onChange事件也会触发。如何防止onChange事件触发onBlur?
handleDomainChange = (e, data) => {
this.setState({
currantDomain_id: data.value,
currantWidget_id: "null",
}, () => {
this.props.dispatch(
statsFetch(
this.props.viewRange,
this.state.currantDomain_id,
this.state.currantWidget_id
)
);
this.widgetsDropdownOptions();
});
}
const DropdownDomains = () => (
<Dropdown
placeholder='all domains'
className="dropdown-title"
value={this.state.currantDomain_id}
selection
options={this.domainsDropdownOptions()}
onChange={this.handleDomainChange}
onBlur={this.nothing}
/>
)
答案 0 :(得分:1)
尝试<Dropdown selectOnBlur={false} .../>
。