相关链接
https://www.cnblogs.com/lodadssd/p/10297989.html
<pdf
:src="pdfPath"
:page="currentPage"
@progress="loadedRatio = $event"
@num-pages="pageCount = $event"
@page-loaded="currentPage = $event"
@link-clicked="currentPage = $event"
@loaded="loadPdfHandler"
>
</pdf>
//引入PDF
import pdf from "vue-pdf";
components: {
pdf,
}
data() {
return {
pdfPath: "",
loadedRatio: 0,
pageCount: 0,
currentPage: 0,
}
}
created() {
this.pdfPath = pdf.createLoadingTask("/test/SDU2017.pdf");
},
methods{
loadPdfHandler(e) {
this.currentPage = 1; // 加载的时候先加载第一页
},
}