如何在ReactJS中的src={pdf}之后添加#toolbar=0



我想用以模式显示PDF

import pdf from '../media/pdf/mypdf.pdf'
<iframe src={pdf} width="100%" height="600px"></iframe>

这很管用。

但我也想删除工具栏,所以我必须在url 的末尾添加#toolbar=0

由于某种原因,我不能将路径直接放入src属性中,我必须使用变量,并且我不知道如何在其上附加#toolbar=0,我该怎么做?

知道吗?

编辑:

从'..导入mypdf/media/pdf/mypdf.pdf’

class HomeLayout extends Component {
render() {
return (
<div className="App">
<div className="container-fluid">
<main>
<div className="modal fade" id="fichePremian" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div className="modal-dialog modal-lg" role="document">
<div className="modal-content " >
<div className="modal-header">
<button type="button" className="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div className="modal-body">
<iframe src={mypdf} width="100%" height="600px"></iframe>
</div>
</div>
</div>
</div>
</main >
</div>
</div>
)//return
}
}
export default HomeLayout;

你试过这样做吗:<iframe src={pdf + '#toolbar=0'} width="100%" height="600px"></iframe>

相关内容

最新更新