有的时候,会出现这样的小问题:
TypeError: Cannot read property '$message' of undefined,
困扰了很久,最近才明白
原因:this的指向问题
this始终指向Vue,所以需要将this保存在that中,在使用其他操作的时候可以用that代替。
var that = this;
完美de解决问题。。。
有的时候,会出现这样的小问题:
TypeError: Cannot read property '$message' of undefined,
困扰了很久,最近才明白
this始终指向Vue,所以需要将this保存在that中,在使用其他操作的时候可以用that代替。
var that = this;
完美de解决问题。。。
本文标题:'$message' of undefined解决办法
本文链接:https://www.haomeiwen.com/subject/iitqbctx.html
网友评论