vue-pdf组件报错vue-pdf Cannot read properties of undefined (reading ‘catch‘)

项目场景:

使用vue-pdf组件实现文件预览功能


问题描述:

安装依赖后报错vue-pdf Cannot read properties of undefined (reading 'catch')
TypeError: Cannot read properties of undefined (reading 'catch')
    at PDFJSWrapper.renderPage (pdfjsWrapper.js?a068:196)
    at VueComponent.resize (componentFactory.js?0d60:75)
    at invokeWithErrorHandling (vue.esm.js?a026:1872)
    at VueComponent.invoker (vue.esm.js?a026:2197)
    at invokeWithErrorHandling (vue.esm.js?a026:1872)
    at VueComponent.Vue.$emit (vue.esm.js?a026:3912)
    at VueComponent.handler (resize-sensor.vue?c7ed:49)
    at invokeWithErrorHandling (vue.esm.js?a026:1872)
    at Watcher.run (vue.esm.js?a026:4593)
    at flushSchedulerQueue (vue.esm.js?a026:4335)

解决方案:

看了很多方法,最后锁定依赖版本解决报错问题。

①在根目录下输入一下命令

npm i pdfjs-dist@2.5.207
npm i vue-pdf@4.2.0

②修改pacakge.json文件

"pdfjs-dist": "2.5.207",
"vue-pdf": "4.2.0"

修改完重新启动项目,就没有再出现报错问题了。

附原文参考链接:https://www.cnblogs.com/thinkingthigh/p/15661288.html

  • 11
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 8
    评论
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值