多个 BlueprintJS Popover 可以有相同的目标吗? (例如,一个用于点击,另一个用于悬停)

Can multiple BlueprintJS Popovers have the same target? (e.g. one for click and another for hover)

假设我有一个 Button 组件,我希望将鼠标悬停在 Button 上时出现 Popover A,并希望在单击该按钮时出现 Popover B。这可能吗?

您可以像这样嵌套弹出框来做到这一点:

  <Popover content={<div>Hover</div>} interactionKind={PopoverInteractionKind.HOVER}>
    <Popover content={<div>Click</div>} interactionKind={PopoverInteractionKind.CLICK}>
      <Button text="Button with two popovers"/>
    </Popover>
  </Popover>

有一个工作示例 here

如果您不希望每当用户单击按钮时出现悬停弹出窗口,您可以通过设置 isOpen 属性切换到 controlled 用法来实现此目的。有关这方面的更多信息,请参阅 BP 文档。