繁体   English   中英

反应引导模式 es6

[英]React bootstrap modal es6

你好,我需要帮助显示引导模式

 import React from 'react';
    import styles from '../App.css';
    import styles from '../../../public/css/app.css';

    import Button from 'react-bootstrap/lib/Button';
    import Modal from 'react-bootstrap/lib/Modal';


    export default class Edit extends React.Component {
      constructor(props) {
    super(props);

    console.log(props)

    this.state=  { showModal: false };

    this.state = {showModal:true};
    this.open = this.open.bind(this);
    this.close = this.close.bind(this);
    }


    close() {
      this.setState({ showModal: false });
    }

    open() {
      alert("open modal")
      this.setState({ showModal: true });
    }


    render() {

      return (
      <div>
        <p>Click to get the full Modal experience!</p>

        <Button
          bsStyle="primary"
          bsSize="large"
          onClick={this.open.bind(this)}
        >
          Launch demo modal
        </Button>

        <Modal show={this.state.showModal} onHide={this.close}>
          <Modal.Header closeButton>
            <Modal.Title>Modal heading</Modal.Title>
          </Modal.Header>
          <Modal.Body>
            <h4>Text in a modal</h4>
            <p>Duis mollis, est non commodo luctus, nisi erat porttitor ligula.</p>

            <hr />

            <h4>Overflowing text to show scroll behavior </h4>
            <p>Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.</p>
          </Modal.Body>
          <Modal.Footer>
            <Button onClick={this.close}>Close</Button>
          </Modal.Footer>
        </Modal>
      </div>

    );
  }
  }

模态没有显示任何建议?

我遵循了 react bootstrap 文档和 babel es6 推荐。

如果你最终想要在你的reactstrap应用程序中再次使用reactstrap ,只需使用reactstrap http://reactstrap.github.io/components/modals/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM