2017-08-31 21 views
0

我希望onChange事件在下拉組件中選擇Item時觸發。但是,即使我點擊其他地方,onChange事件也會觸發。如何防止onCurnge事件觸發onBlur?如何在語義使用中防止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} 
     /> 
    ) 

回答

1

嘗試<Dropdown selectOnBlur={false} .../>