App.vue:45 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'get')
时间: 2023-10-17 07:32:23 浏览: 180
Vue打包Cannot read property 'tapPromise' of undefined报错处理.docx
5星 · 资源好评率100%
在这段代码中,报错Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'get')是因为在使用this.checkLogin()时没有返回值。解决这个问题的方法是在checkLogin函数中加上return语句。例如,将checkLogin函数改为以下形式:
checkLogin:function (){
return axios.get("checkLogin");
}
这样就可以解决该报错。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [Uncaught (in promise)和Uncaught (in promise) TypeError: Cannot read properties of undefined (readin](https://blog.csdn.net/weixin_40476233/article/details/126107676)[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* [Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘data‘)的报错](https://blog.csdn.net/qq_49150614/article/details/125286452)[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 ]
阅读全文