消除上下文菜单关闭延迟

时间:2019-03-19 11:25:56

标签: antd

我想在d3js-svg上使用antd context-menu,效果很好。但是,此上下文菜单有一个“关闭”延迟,不适用于此应用程序。

enter image description here

是否有消除此关闭延迟的正确方法? (我为transitionNamemouseLeaveDelay尝试了不同的值,但没有成功)

<Dropdown overlay={this.state.contextMenu.menu} trigger={['contextMenu']}>
    <svg height='70vh' width='100%'>
    </svg>
</Dropdown>

谢谢!

旧(带有mouseLeaveDelay={0}):

<Dropdown mouseLeaveDelay={0} overlay={this.state.contextMenu.menu} trigger={['contextMenu']}>
    <svg height='70vh' width='100%'>
    </svg>
</Dropdown>

2 个答案:

答案 0 :(得分:0)

尝试删除mouseLeaveDelay={0},它似乎是一个可选参数,并且可能是罪魁祸首。

因为这样的事情有效:

  <Dropdown overlay={menu}>
    <a className="ant-dropdown-link" href="#">
      Hover me <Icon type="down" />
    </a>
  </Dropdown>,

我想这与您创建菜单或上下文菜单触发器的方式有关。也许挂在contextMenu上了。遵循示例,尝试使其尽可能简单,然后再回到解决方案中,您将找到罪魁祸首。

答案 1 :(得分:0)

使用以下CSS

.ant-dropdown {
    animation-duration: 0s !important;
}

希望,这会有所帮助。