阿里云浏览文档:https://help.aliyun.com/document_detail/162639.html?spm=a2c4g.11186623.6.567.7ee41fc4uSpkgE
vue浏览插件:https://github.com/cainsyake/vue-doc-preview/blob/master/README-CN.md
预览pdf
1. iframe
<iframe
:src="url"
ref="ifamePage"
width="100%"
frameborder="no"
border="0"
marginwidth="0"
marginheight="0"
height="100%"
<p>您的浏览器不支持iframe标签</p>
</iframe>
url:'http://cloudt-aliyun-test-vpc-pub.oss-cn-beijing.aliyuncs.com/safe/education_files/GPD20191218.pdf',
总结:
1)pdf展示的很好,
2)word、excel、ppt不支持,直接下载了
方法2
<embed :src="url" type="application/pdf" width="100%" height="100%">
方法3:
object
同上
http://jhyt.oss-cn-shanghai.aliyuncs.com/images/1531367199089_PDFObject.js
以上4种方法的缺点:不支持ie
方法5:(目前看最佳)
https://github.com/mozilla/pdf.js#online-demo
http://blog.lookpeakfans.xyz/2018/07/22/preview-pdf/
二、word、xls、ppt文件在线预览功能
<iframe src='https://view.officeapps.live.com/op/view.aspx?src=http://storage.xuetangx.com/public_assets/xuetangx/PDF/1.xls' width='100%' height='100%' frameborder='1'>
用法:打开页面https://view.officeapps.live.com/op/view.aspx?src=文件路径,即可在线预览文档。
文件路径必须为 http:// 或 https:// 形式,文档必须是 Word、Excel 或 PowerPoint 文档。
问题:资源是公共访问的