簡體   English   中英

reactjs中的React Modal

[英]React Modal in reactjs

我已將react-modal用於模態對話框,

在我的reactjs render()中,我有以下模態

return(
        <ReactModal
        isOpen={this.state.showModal}
        contentLabel="Minimal Modal Example">
        <button style={styleClose} onClick={this.handleCloseModal}>
      CloseModal</button>
        {items}
     </ReactModal>
    )

但是,當此對話框打開時,后面的項目是重疊的,我如何才能僅顯示對話框而不顯示背景元素?

重疊的元素是具有單選按鈕的組件。 普通文本不重疊。 如何使這些按鈕不重疊?

我嘗試設置zIndex並應用樣式,但這不起作用。

當我也在鍵盤上單擊esc時,如何關閉?

您問題的第一部分需要更多信息以進行澄清,我可以回答第二部分:

將此添加到您的模式元素中: shouldCloseOnEsc={true}

如果還沒有,請記住還要添加onRequestClose={<your component method that hides the modal}

檢查此鏈接以了解更多用法: http : //reactcommunity.org/react-modal/#usage

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM