模板使用
<pdf ref="pdf" :src="pdfUrl" style="width: 100%;"></pdf>
安裝pdf
npm install --save vue-pdf
在需要使用的頁面引用
import pdf from 'vue-pdf' export default { components:{ pdf:pdf }, }
獲取到pdf的url后直接賦值即可
this.pdfUrl = pdf.createLoadingTask(pdfurl)
相關學習鏈接 https://blog.csdn.net/weixin_43452622/article/details/88234792
pdf預覽dom:https://github.com/goSunadeod/vue-pdf.js-demo