Cannot read properties of null (reading 'queryData')
时间: 2023-11-10 09:56:05 浏览: 33
这个错误“Cannot read properties of null (reading 'queryData')”通常发生在你试图读取一个空值或null的属性时。在这种情况下,'queryData'属性为空或null,因此无法读取它的任何子属性。要解决这个问题,你可以在使用'queryData'属性之前,确保它不为空或null。
相关问题
TypeError: Cannot read properties of null
TypeError: Cannot read properties of null (reading 'indexOf') 错误是因为尝试在一个null值上调用indexOf()方法。这个错误通常发生在代码中试图访问一个对象的属性或方法,但该对象的值为null或undefined时。
在你提供的引用中,报错的代码是filterMethod(query, item)函数中的item.pinyin.indexOf(query)。这意味着item.pinyin的值为null。要解决这个问题,你可以在调用indexOf()方法之前先检查item.pinyin的值是否为null。
另外,如果你在代码中使用了类似于optionsFormID为null的情况,也可以通过检查optionsFormID的值是否为null来解决问题。 <span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [TypeError: Cannot read properties of null (reading ‘indexOf‘)](https://blog.csdn.net/m0_61002365/article/details/120703458)[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%"]
- *3* [ASP.NET MVC运行出现Uncaught TypeError: Cannot set property __MVC_FormValidation of null的解决方法](https://download.csdn.net/download/weixin_38680671/14876308)[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 ]
Cannot read properties of null (reading 'nodeName') 仍然报此错误
如果你仍然遇到相同的错误,说明问题可能出现在其他地方。请确保以下几点:
1. 确保 `getPidValue` 方法中的 `data` 参数是由下拉树组件传递的正确数据。你可以在 `getPidValue` 方法中使用 `console.log(data)` 来打印出 `data` 的值,以确认它是否为 null 或正确的数据。
2. 确保在点击清空时,下拉树组件正确地触发了 `getPidValue` 方法。你可以在点击清空时使用 `console.log` 打印一些信息,确保 `getPidValue` 方法被调用。
3. 如果以上两个方面都没有问题,那么问题可能出现在其他地方的代码中。你可以仔细检查其他与下拉树组件相关的逻辑,看看是否有其他地方对 `this.queryParams.resName` 进行了赋值或操作,导致出现 null 值。
如果你仍然无法解决问题,请提供更多相关的代码和错误日志,以便我能够更好地帮助你排查问题。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)