Javascript React.js触发器单击事件
我正在尝试在react.js组件中触发click事件Javascript React.js触发器单击事件,javascript,reactjs,Javascript,Reactjs,我正在尝试在react.js组件中触发click事件 <DropdownButton bsStyle='darkgreen45' title={id_str} class='apps_dropdown' key="test" id="sub_nav_btn"> <SidebarNavItem eventKey="1" name='Application1' onClick={()=>this.handleClick()} href={::this.getP
<DropdownButton bsStyle='darkgreen45' title={id_str} class='apps_dropdown' key="test" id="sub_nav_btn">
<SidebarNavItem eventKey="1" name='Application1' onClick={()=>this.handleClick()} href={::this.getPath('application1')} />
<SidebarNavItem eventKey="2" name='Application2' href={::this.getPath('application2')} />
</DropdownButton>
我使用的是模板组件。
但单击菜单项DropdownButton需要关闭,但不能工作。
所以我试着手工制作
当我点击其他任何地方时,菜单项下拉菜单正在折叠
所以我想触发点击事件
我该怎么做
下面是DropdownButton组件的代码片段
<DropdownButton bsStyle='darkgreen45' title={id_str} class='apps_dropdown' key="test" id="sub_nav_btn">
<SidebarNavItem eventKey="1" name='Application1' onClick={()=>this.handleClick()} href={::this.getPath('application1')} />
<SidebarNavItem eventKey="2" name='Application2' href={::this.getPath('application2')} />
</DropdownButton>
this.handleClick()}href={::this.getPath('application1')}/>
如果有任何帮助,我们将不胜感激。您是否正在寻找一个听起来像是要在用户未单击下拉按钮时触发事件的消息?发布整个
SidebarNavItem
。它可能不接受onClick
prop。