【问题标题】:ANTD onFocus is not called every time while i open the select options当我打开选择选项时,每次都不会调用 ANTD onFocus
【发布时间】:2019-10-28 16:21:26
【问题描述】:

聚焦时调用onFocus

在这里,我正在使用antd 选择我在哪里使用 onFocus 道具,当​​我单击或打开选择选项时,它实际上应该被调用。但它并不是每次都被调用。有什么问题?

实际上,我的项目中有很多选择框,而且我使用的是相同的选择框,所以每当我关注选择框时,我都会获取特定的选择框选项。

但由于每次遇到问题时都不会调用 onFocus。

Codesandbox notworking example

codesandbox Working example

Select 不支持 onClick。但我需要的是 onclick 事件,这样每次我点击选择框时我都想获取数据。

【问题讨论】:

  • 在 Codesandbox 示例中链接其工作正常
  • @AkshayMulgavkar 实际上,我想在每次单击选择框时调用 onFocus。但我发现 onDropdownVisibleChange 可以在其中实现我的功能。无论如何,谢谢。

标签: javascript html reactjs select antd


【解决方案1】:

在这里,我找到了解决方案: 我实际上可以获取数据

onDropdownVisibleChange

谢谢@antdDesign

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-22
    • 1970-01-01
    • 2023-03-24
    • 1970-01-01
    • 1970-01-01
    • 2016-06-17
    • 1970-01-01
    相关资源
    最近更新 更多