import{onMounted,reactive,ref}from'vue';importVuePdfEmbedfrom"vue-pdf-embed";// 导入自己的文件importpdfUrlfrom'./2021试卷.pdf';constpdfState=reactive({pdfSource:{url:pdfUrl,cMapUrl:'https://cdn.jsdelivr.net/npm/pdfjs-dist@2.9.359/cmaps/',cMapPacked:true,},// 当前页pageNum:1,// 总...
1. 安装vue-pdf-embed 首先,你需要在Vue 3项目中安装vue-pdf-embed库。你可以通过npm或yarn来安装。 使用npm安装: npminstallvue-pdf-embed Bash Copy 使用yarn安装: yarnaddvue-pdf-embed Bash Copy 安装完成后,就可以在Vue组件中使用vue-pdf-embed来嵌入PDF文件。 2. 组件化设计:实现PDF预览 接下来,我们将...
在vue3中使用vue-pdf-embed,不显示内容 <template> <div class="pdf-preview"> <div class="pdf-wrap"> <vue-pdf-embed :source="state.source" :style="scale" class="vue-pdf-embed" :page="state.pageNum" /> </div> <div class="page-tool"> <div class="page-tool-item" @click="lastPag...
在vue3中使用vue-pdf-embed,不显示内容 <template> <div class="pdf-preview"> <div class="pdf-wrap"> <vue-pdf-embed :source="state.source" :style="scale" class="vue-pdf-embed" :page="state.pageNum" /> </div> <div class="page-tool"> <div class="page-tool-item" @click="lastPag...
在vue3中使用vue-pdf-embed,不显示内容 <template> <div class="pdf-preview"> <div class="pdf-wrap"> <vue-pdf-embed :source="state.source" :style="scale" class="vue-pdf-embed" :page="state.pageNum" /> </div> <div class="page-tool"> <div class="page-tool-item" @click="lastPag...
在vue3中使用vue-pdf-embed,不显示内容 <template> <div class="pdf-preview"> <div class="pdf-wrap"> <vue-pdf-embed :source="state.source" :style="scale" class="vue-pdf-embed" :page="state.pageNum" /> </div> <div class="page-tool"> <div class="page-tool-item" @click="lastPag...