因为 这行代码引入有问题,vite不支持文件里的写法 vite不支持这个文件内容的写法 会报错 PDF.GlobalWorkerOptions.workerSrc = "/file/public/pdfjs-dist-res/pdf.worker.min.js"; 改成引用pdf.worker.js PDF.GlobalWorkerOptions.workerSrc= "/file/public/pdfjs-dist-res/pdf.worker.js";
在Vite项目中,通常使用动态导入来确保路径正确。 typescript PDFJS.GlobalWorkerOptions.workerSrc = new URL('./pdf.worker.js', import.meta.url).href; Vue3的Proxy问题:在某些情况下,由于Vue3的响应式系统使用了Proxy,可能会导致pdfjs-dist无法正确访问PDF对象。此时,可以使用Vue的toRaw函数将响应式对象转换...
vue3 pdf viewer. Latest version: 1.0.13, last published: a year ago. Start using pdf-vue3-vite in your project by running `npm i pdf-vue3-vite`. There are no other projects in the npm registry using pdf-vue3-vite.
import{onMounted,reactive,ref}from'vue';importVuePdfEmbedfrom"vue-pdf-embed";// 导入自己的文件importpdfUrlfrom'./2021试卷.pdf';constpdfState=reactive({pdfSource:{url:pdfUrl,cMapUrl:'https:///npm/pdfjs-dist@2.9.359/cmaps/',cMapPacked:true,},// 当前页pageNum:1,// 总页数numPages:1,})...
Vite-vue3pdf The package contains aVue 3component to easily display PDF files in Vite. Note: This project depends on@bundled-es-modules/pdfjs-distwhich is currently quite a few versions behind pdfjs-dist Note: Make sure to manually copypdf.worker.min.jstopublic/pdfjs/pdf.worker.js(defaul...
<HelloWorld msg="Vite + Vue"/> </template> importHelloWorld from'./components/HelloWorld.vue' //import PDFView from './components/vuepdfjs.vue' // 可以 //import PDFView from './components/pdfPreview.vue' // 可以 importPDFView from"./components...
Vue3 是一种流行的 JavaScript 框架,它提供了创建单文件组件(Single File Components,SFC)的方式。单...
pdf-fge-vue3 1.4.1•Public• Published3 months ago Dependencies (2) pdfjs-dist print-js Dev Dependencies (14) @rushstack/eslint-patch @vitejs/plugin-vue @vue/eslint-config-prettier @vue/eslint-config-typescript eslint eslint-plugin-vue...
使用Vue CLI来初始化一个新的Vue3项目/使用vite来初始化一个新的Vue3项目,在创建过程中,选择默认的Vue3配置即可。 代码语言:javascript 代码运行次数:0 运行 AI代码解释 vue create vue3-pdf-demo// 或者npm create vitecd vue3-pdf-demo 2、安装依赖 ...
项目本身配置99%都在vite.config.ts里面,参数设置都在根目录下,而非src下 src下的config目录是系统默认参数,及部分数据配置 使用reactive 请使用 let,使用 ref 请使用const !!!注意VUE3中的reactive使用,如果需要更新视图需要抽出interface。!!! 开发问题 Typescript 和 TSX TS的泛型 在结合 tsx 的时候使用as形式...