61,112
社区成员
发帖
与我相关
我的任务
分享
方法一是then中使用箭头函数
axios.get(xxxxxx).then((result)=>{
this.errormessage=result.data
})
方法二是把外层函数的this赋值给一个变量,在内层函数中使用这个变量
xxxx: function () {
let that = this;
axios.get(xxxxx).then(function (result) {
that.errormessage=result.data
})
}