reactjs - 如何在 ReactJS 中的 src={pdf} 之后添加#toolbar=0
问题描述
我想以模式显示 PDF,使用
import pdf from '../media/pdf/mypdf.pdf'
<iframe src={pdf} width="100%" height="600px"></iframe>
这很好用。
但我也想删除工具栏,所以我必须#toolbar=0
在网址末尾添加
我该怎么做,由于某种原因,我不能将路径直接放入 src 属性,我必须使用一个变量,我不知道如何附加#toolbar=0
它?
任何想法 ?
编辑:
从'../media/pdf/mypdf.pdf'导入mypdf
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">×</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>
推荐阅读
- tfs - 在 TFS2018 工作项“分配给”字段中找不到一些现有用户。即使他们被添加到团队项目中
- javascript - ReactJS - .map 函数内的 REST API 查询?
- typescript - 如何调试并进入使用 TypeScript 编写的 npm 模块?
- dafny - 如何在 Dafny 中编写一个干净的函数来获得最小的集合?
- php - 更改数据库表名会阻止存储位置数据
- tensorflow - 在 Anaconda 上安装最新的 tensorflow 版本
- python - 如何在 wxPython 中动态定位元素
- networking - 如何让一个 pod 与 Kubernetes 中的另一个 pod 联网?(简单的)
- rasa-core - Rasa:“构建一个简单的机器人”中的错误
- web - 在 / 之后处理自定义 URL 部分