Error in event handler for "resize": "TypeError: Cannot read properties of undefined (reading 'catch')"
时间: 2023-11-04 22:21:34 浏览: 122
该错误是由于在处理"resize"事件的事件处理程序中发生了一个类型错误,该错误指示无法读取未定义对象的属性"catch"。
解决该问题的方法是修改"vue-pdf"库的代码或更新"vue-pdf"库的版本。一种解决方法是找到"node_modules/vue-pdf/src/pdfjsWrapper.js"文件,并注释掉相关代码。
另一种解决方法是直接修改"package.json"文件,删除"vue-pdf"依赖,并添加以下两行代码,然后重新执行"npm i"来安装依赖并重新运行项目:
```json
{
"vue-pdf": "^4.2.0",
"pdfjs-dist": "^2.5.207"
}
```
这样,问题中的错误应该就可以解决了。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [vue-pdf报错Cannot read properties of undefined (reading ‘catch‘)“ found in](https://blog.csdn.net/CCAHSC/article/details/131575931)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* [解决vue-pdf报错TypeError: Cannot read properties of undefined (reading ‘catch‘)](https://blog.csdn.net/i_am_a_div/article/details/127104250)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文