axios做ajax 请求的时候遇到的一个小问题:TypeError: Cannot read property ‘$message’ of undefined
这是一个this指向问题,this始终指向Vue,所以需要将this保存在that中,在使用其他操作的时候可以用that代替。
具体操作:
var that = this;
再用 that去调用你要调用的方法
完美解决问题。。。
原文链接:https://blog.csdn.net/qq_43374210/article/details/100731755