下载好pdf文件之后,使用下面代码引入
<iframe :src="'http://'+locationHost+'/static/pdf/web/viewer.html?file='+noticeData.contentFile" width="100%" height="1300px"></iframe>
src中前面为下载的pdf文件中viewer.html的位置,file后接pdf的网络地址,代码未上传服务器时文件位置写固定位置
'../../../../static/pdf/web/viewer.html'
代码上传服务器之后可以使用网络地址,也可以根据pdf文件的前缀动态的拼接pdf文件地址
this.locationHost = this.noticeData.contentFile.split('/')[2]