问题描述
我试图在单击反应选择的选定值"元素时显示弹出窗口,如下所示:
I am trying to display a popover on click over a react-select selected value element as follow :
当我单击弹出窗口触发器时,会发生我的问题,下拉菜单也会打开,而且弹出窗口也...我只想打开弹出窗口,我尝试了 e.nativeElement.stopPropagation
,e.stopPropagation
, e.preventDefault
等都没有成功.这是一个沙箱,如果您想知道我是怎么做的以及如何重现该问题.
My issue happens when I click on the popover trigger, the dropdown opens and the popover too... I just want to open the popover, I tried e.nativeElement.stopPropagation
, e.stopPropagation
, e.preventDefault
and so on without success. Here is a sandbox If you want to know how I did this and how to reproduce the issue.
https://codesandbox.io/s/pjv7vmlv3j
感谢您的帮助
推荐答案
好吧,我找到了一种取消事件的方法.我只需在< Select/>
上添加 onValueClick
道具,然后在其中放置 stopPropagation
!
Well I found a way to cancel the event. I just add an onValueClick
prop to the <Select />
and put the stopPropagation
there!
这篇关于反应选择-无法在valueRenderer组件上停止传播的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!