Cannot read properties of undefined (reading 'token')
时间: 2023-10-18 19:26:14 浏览: 111
"Cannot read properties of undefined (reading 'token')" 错误是由于尝试在未定义的对象上访问属性 'token' 导致的。这个错误通常发生在尝试访问一个不存在或未初始化的对象的属性时。根据引用和引用的描述,当您访问store.user.state.userInfo.data.token时,如果userInfo或data为undefined,则会出现这个错误。请确保在访问对象的属性之前,确保对象已被正确地初始化和赋值。您可以通过在访问之前使用条件判断或者在对象初始化时设置默认值来解决这个问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘token‘)](https://blog.csdn.net/qq_55629923/article/details/126812976)[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* *3* [解决Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘id‘)报错](https://blog.csdn.net/m0_57524265/article/details/131441971)[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 ]