step three: handlePDFExport and it's onClick event
This commit is contained in:
Родитель
2b7ca06ba1
Коммит
e16ae75b43
11
src/App.js
11
src/App.js
|
@ -8,18 +8,25 @@ import './App.css';
|
|||
import 'bootstrap-4-grid/css/grid.min.css';
|
||||
|
||||
class App extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.appContainer = React.createRef();
|
||||
}
|
||||
handlePDFExport = () => {
|
||||
savePDF(ReactDOM.findDOMNode(this.appContainer), { paperSize: 'auto' });
|
||||
}
|
||||
render() {
|
||||
return (
|
||||
<Ripple>
|
||||
<div className="bootstrap-wrapper">
|
||||
<div className="app-container container">
|
||||
<div className="app-container container" ref={(el) => this.appContainer = el}>
|
||||
<div className="row">
|
||||
<div className="col-xs-6 col-sm-6 col-md-6 col-lg-6 col-xl-6">
|
||||
<h1>Sales | Q4 2018</h1>
|
||||
</div>
|
||||
<div className="col-xs-6 col-sm-6 col-md-6 col-lg-6 col-xl-6 buttons-right">
|
||||
<Button primary={true}>Share</Button>
|
||||
<Button>Export to PDF</Button>
|
||||
<Button onClick={this.handlePDFExport}>Export to PDF</Button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="row">
|
||||
|
|
Загрузка…
Ссылка в новой задаче