【问题标题】:showCloseButton react-bootstrap-sweetalert not displayedshowCloseButton react-bootstrap-sweetalert 未显示
【发布时间】:2019-12-02 23:32:08
【问题描述】:

我正在使用 lib react-bootstrap-sweetalert 来处理弹出窗口。到目前为止,一切都很好。但是,当我尝试实现他们的一个道具showCloseButton - 描述为here - 时,关闭按钮不会显示在我的警报中的任何位置。然后,我尝试将代码复制粘贴到他们的示例here 中,代码如下:

<SweetAlert
  custom
  showCancel
  showCloseButton
  confirmBtnText="Yes"
  cancelBtnText="No"
  confirmBtnBsStyle="primary"
  cancelBtnBsStyle="default"
  customIcon="https://raw.githubusercontent.com/djorg83/react-bootstrap-sweetalert/master/demo/assets/thumbs-up.jpg"
  title="Do you like thumbs?"
  onConfirm={this.onConfirm}
  onCancel={this.onCancel}
>
  You will find they are up!
</SweetAlert>

“x”关闭按钮仍未显示在我的警报中。然后,我尝试在他们的示例中显示警报,显示关闭按钮!这里出了什么问题?我已经复制粘贴了,它不起作用。但是,它正在他们的示例网站上工作。无论如何,我使用的是^4.4.1react-bootstrap-sweetalert 版本。

【问题讨论】:

    标签: javascript reactjs sweetalert


    【解决方案1】:

    我认为该示例适用于其最新版本。请更新到最新!

    这是因为我在 v4.4.1 中看不到选项showCloseButtonhttps://www.npmjs.com/package/react-bootstrap-sweetalert/v/4.4.1

    【讨论】:

    • 是的,我在再次查看 github repo 后想通了。此外,如果有人阅读此内容并成功显示关闭按钮但无法点击,我敢打赌,因为警报的标题会覆盖按钮。尝试将 z-index 赋予关闭按钮会有所帮助
    猜你喜欢
    • 1970-01-01
    • 2018-06-30
    • 2022-10-23
    • 2020-10-29
    • 2020-06-30
    • 1970-01-01
    • 2021-04-12
    • 2020-07-20
    • 2019-01-29
    相关资源
    最近更新 更多