你好,我需要帮助显示一个bootstrap模式
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>
);
}
}
模态没有显示任何建议?
我跟着反应bootstrap文件和babel es6推荐。
如果您最终再次想要在您的反应应用程序中使用bootstrap,只需使用reactstrap
http://reactstrap.github.io/components/modals/