Vue 报错ReferenceError: $ is not defined
时间: 2023-08-24 18:04:29 浏览: 285
引用中提到的解决方法是在vue.config.js中添加一些配置,其中使用了webpack的ProvidePlugin插件来提供全局的jquery变量。这样就能解决报错"ReferenceError: $ is not defined"的问题。中提到的报错提示不是由于没有使用lib:["dom"]造成的,而是在类型注释中使用了MouseEvent。在这种情况下,没有问题的。中指出,如果项目中引用了.eslintrc.js文件,还需要在文件的module.exports中为env添加一个键值对jquery: true,然后重新启动项目。这样也可以解决报错"ReferenceError: $ is not defined"的问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [Vue引入JQuery报错caught ReferenceError: jQuery is not defined](https://blog.csdn.net/qq_46034741/article/details/130032090)[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^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [vue ssr 报错 ReferenceError: MouseEvent is not defined / window is not defined 等等](https://blog.csdn.net/qq_28550263/article/details/130152398)[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^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [Vue小知识: $ is not defined错误解决](https://blog.csdn.net/weixin_43945983/article/details/88294052)[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^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文