vueqr插件报错TypeError: Cannot read properties of undefined (reading '_c')
时间: 2023-09-21 09:10:10 浏览: 215
处理JavaScript值为undefined的7个小技巧
这个报错的原因是在创建Vue实例时,Vue还没有生成DOM,因此无法获取到`this.$refs.qrCodeUrl`对应的DOM元素,从而导致报错。,我注意到您对于路由组件的配置出现了一些错误。在路由配置中,子组件的`component`属性应该是`components`而不是`component`。所以您需要修改代码中的`components`为`component`,如下所示:
```
{ path: 'detail', component: Detail }
```
请将这个修改后的代码应用到您的项目中,应该就能解决报错问题了。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [qrcodejs2报错 TypeError: Cannot read properties of undefined (reading ‘appendChild‘)](https://blog.csdn.net/lornall/article/details/130124422)[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: 50%"]
- *2* *3* [Vue路由报错:TypeError: Cannot read properties of undefined (reading ‘_self‘)undefined (reading ...](https://blog.csdn.net/weixin_43913958/article/details/131249314)[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: 50%"]
[ .reference_list ]
阅读全文