簡體   English   中英

反應 Typescript:Antd 模態未打開

[英]React Typescript: Antd Modal not opening

您好,我在單擊按鈕后嘗試打開模態框,但由於某種原因無法打開。 即使在瀏覽器元素中也不會出現。

這是模式和按鈕的代碼:

<Button type="primary" icon={<EditOutlined />} onClick={() => this._updateQuestion(record, true) } />


private _updateQuestion = (record, modalVisible: boolean): JSX.Element => {
        return (
            <Modal
                title="Bearbeitung"
                centered
                visible={modalVisible}
                onOk={() => false}
                onCancel={() => false}
                width={1000}
            >
                <p>some contents...</p>
                <p>some contents...</p>
                <p>some contents...</p>
            </Modal>
        )
    }
return (
  <>
     <Button type="primary" icon={<EditOutlined />} onClick={() => this.setState({modalVisible: true}) />
     <Modal
       title="Bearbeitung"
       centered
       visible={this.state.modalVisible}
       onOk={() => {this.setState({modalVisible: false})}}
       onCancel={() => {this.setState({modalVisible: false})}}
       width={1000}
     >
         <p>some contents...</p>
         <p>some contents...</p>
         <p>some contents...</p>
     </Modal>
</>
)

暫無
暫無

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

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