2

当我在下拉组件中选择一个项目时,我希望 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}
        />
    )
4

1 回答 1

4

试试<Dropdown selectOnBlur={false} .../>

于 2017-09-09T16:45:42.083 回答