Error in v-on handler: "TypeError: Cannot read properties of undefined (reading 'indexOf')
时间: 2023-08-28 17:18:26 浏览: 89
引用中提到,当出现错误"TypeError: Cannot read properties of undefined (reading 'indexOf')"时,大概率是以下两种情况之一:1) 对象本身为空undefined,所以无法读取属性;2) 试图读取不应该读取的属性,比如在数组中读取属性值或在对象中读取length值。引用中也提到,可以先确认报错位置调用对象的类型,然后做空值判断即可。在你的代码中,可以检查一下是否正确地获取了id,因为封装的方法中有id,但是页面上没有找到,所以报错了。请确保你正确地获取了id。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [Error in v-on handler: “TypeError: Cannot read properties of undefined (reading ‘0‘)](https://blog.csdn.net/qingpingguo12/article/details/127858313)[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^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* [Error in v-on handler: “TypeError: Cannot read properties of null (reading ‘getElementsByTagName...](https://blog.csdn.net/qq_57305148/article/details/123188618)[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^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文