使用vue-pdf预览pdf文件

本地预览的话,如果是使用cli/3,需要把pdf文件放到 public 文件下中,新建一个 static 文件夹,放入其中

使用

安装 vue-pdf
只能使用绝对路径,而且 / 就表示 public 文件夹,所以需要忽略掉,如下

import pdf from "vue-pdf"

components:{
    
    
	pdf 
}

<pdf src="/static/aaa.pdf"></pdf>  

远程的话,就是url


有的使用pdf.js插件之类的,最终总归也是你线上的地址,https:xxxx/xxx.com/xxx.pdf +其他处理 实现的,地址

猜你喜欢

转载自blog.csdn.net/sxs7970/article/details/119675514