Error in v-on handler: “TypeError: this is not a function“
Error in v-on handler: “TypeError: this is not a function”
在进行简单登录跳转的测试中,出现Error in v-on handler: "TypeError: this is not a function"的错误
async UserLogin() {try {//登录成功const {phone, password} = thisphone && password && await this.$store.dispatch('UserLogin', {phone, password})//跳转到home首页this.$router.push('/home');} catch (error) {alert(error.message);}}
原因:
在 const {phone, password} = this 代码后面没有加上分号,导致代码解析的时候误认为该行代码没有结束,this指向不一致
解决方案:
只需要在后面加上分号即可
async UserLogin() {try {//登录成功const {phone, password} = this;phone && password && await this.$store.dispatch('UserLogin', {phone, password});//跳转到home首页this.$router.push('/home');} catch (error) {alert(error.message);}}
Error in v-on handler: “TypeError: this is not a function“相关推荐
- 使用天地图报错Error in v-on handler: “TypeError: Cannot read property ‘_tdt_events‘ of null
地图官网获取服务许可key:国家地理信息公共服务平台 天地图 vue使用天地图报错Error in v-on handler: "TypeError: Cannot read propert ...
- chrome浏览器中遇到bug【Error in event handler: TypeError: Cannot read property 'name' of undefined】
报错信息: Error in event handler: TypeError: Cannot read property 'name' of undefinedat f (chrome-extens ...
- Error in v-on handler: “TypeError: 对象不支持“set”属性或方法“
Error in v-on handler: "TypeError: 对象不支持"set"属性或方法" FormData.set() 所有IE不兼容 MDN-F ...
- Vue父组件调用子组件方法,报错[Vue warn]: Error in v-on handler: “TypeError: _this.$emit is not a function“
症状 一开始浏览器控制台报这个错[Vue warn]: Error in v-on handler: "TypeError: _this.$emit is not a function&qu ...
- Vue报错:Error in v-on handler: “TypeError: Cannot read properties of undefined (reading ‘skuId‘)“
背景: 当点击按钮时候,正常情况控制台的Network应该要发送一个变化量,现在控制台的Network不仅不显示,而且还报错,报错信息如下: vue.runtime.esm.js?c320:619 [ ...
- 使用spring-cloud-bus报错error occurred in message handler [org.springframework.integration.amqp.outbound
完整报错信息 error occurred in message handler [org.springframework.integration.amqp.outbound.AmqpOutbound ...
- 【问题】yocto学习:ERROR: Execution of event handler ‘sstate_eventhandler2‘ failed
bitbake在最简单的配方上失败了 1. 编译报错问题:ERROR: Execution of event handler 'sstate_eventhandler2' failed 下载yocto ...
- “Uncaught TypeError: string is not a function”
http://www.cnblogs.com/haitao-fan/archive/2013/11/08/3414678.html 今天在js中写了一个方法叫做search(),然后点击按钮的时候提示 ...
- Uncaught TypeError: object is not a function
Created by Jerry Wang, last modified on Aug 24, 2014 在Chrome里使用BSP page遇到如下error: 错误指向onclick proper ...
最新文章
- python跟java-还在纠结选Python还是Java?看完就有数了
- 元宇宙大比拼:英伟达Nvidia,Facebook,iwemeta
- linux下的ps 查看进程命令
- STL源码剖析(四)
- CSS3 border-image的使用方法
- java虚拟机工作原理图_Java虚拟机工作原理
- E820-DTU与昆仑通态组态软件联机
- 基于JAX-WS的webService开发实例
- Confluence 6 PostgreSQL 创建数据库和数据库用户
- 基于JAVA+SpringMVC+Mybatis+MYSQL的二手车辆在线交易系统
- JavaEE中级.20190615.易买网项目(一).隐藏域.
- 2017java编程大赛,电子信息系第一届java编程大赛实施方案
- python类和对象
- java ctor_.ctor,.cctor 以及 对象的构造过程
- # GIT团队实战博客
- Linux 5.19 迎来首个候选版本,Linus:多平台 Linux 内核“差不多完成了”
- 中国真正的毒奶粉在哪
- java fianlly_Java冷知识:finally中的代码一定会执行吗?
- 【已解决】部分安卓手机,部分ios机型,调微信的jssdk方法失败
- 上海自考计算机本科考哪些专业吗,上海自考本科有哪些专业