【问题标题】:is there a way to add custom html inside the Popconfirm in antd and React有没有办法在 antd 和 React 的 Popconfirm 中添加自定义 html
【发布时间】:2019-09-05 10:12:27
【问题描述】:

遵循这个实现 =>

https://codepen.io/pen/?&editable=true&editors=001

我想创建一个类似的东西,当我点击一个按钮时,弹出窗口出现在弹出窗口中,而不仅仅是简单的文本和按钮,我想要一个完全自定义的 html。 (或反应组件)

我找不到任何方法。

我尝试添加

  <Popconfirm
    placement="leftBottom"
    title={text}
    onConfirm={confirm}
    okText="Yes"
    cancelText="No"
  >
    <Button>LB</Button>
    if(this.state.isOpen){
       <div>custom<div>
    }
  </Popconfirm>

但它不起作用。

有没有办法做到这一点?

【问题讨论】:

标签: reactjs antd


【解决方案1】:

使用接受ReactNodePopconfirmtitle property

请注意,Tooltip API 可用于此组件。

<Popconfirm
  placement="topRight"
  title={<div>custom</div>}
  onConfirm={() => console.log("confirmed")}
  okText="Yes"
  cancelText="No"
>
  <Button>TR</Button>
</Popconfirm>

【讨论】:

    猜你喜欢
    • 2018-10-31
    • 1970-01-01
    • 1970-01-01
    • 2020-11-13
    • 2012-11-03
    • 1970-01-01
    • 1970-01-01
    • 2011-06-24
    • 2016-11-05
    相关资源
    最近更新 更多