Javascript Axios-无法更改变量数据值

Javascript Axios-无法更改变量数据值,javascript,rest,vue.js,axios,vue-cli-3,Javascript,Rest,Vue.js,Axios,Vue Cli 3,我尝试使用axios更改变量数据,我使用的是vue axios和vue cli 3 代码如下: const qs=require('qs')) 导出默认值{ 姓名:'家', 数据:函数(){ 返回{ 电子邮件:空, 错误电子邮件:错误, baseUrl:'https://www.example.com/isemail.php' } }, 方法:{ 下一步:函数(){ }, 错误:函数(){ this.axios.post(this.baseUrl+'functions/isEmail.php'

我尝试使用axios更改变量数据,我使用的是vue axios和vue cli 3

代码如下:

const qs=require('qs'))
导出默认值{
姓名:'家',
数据:函数(){
返回{
电子邮件:空,
错误电子邮件:错误,
baseUrl:'https://www.example.com/isemail.php'
}
},
方法:{
下一步:函数(){
},
错误:函数(){
this.axios.post(this.baseUrl+'functions/isEmail.php',qs.stringify({
价值:这是一封电子邮件
}))
.然后(功能(resp){
this.errEmail=true
})
}
}
}
目标成功
更改此选项

.then(function (resp) {
  this.errEmail = true
})
对此

.then((resp) => {
  this.errEmail = true
})
或手动绑定此

   .then(function (resp) {
      this.errEmail = true
    }.bind(this))
改变这个

.then(function (resp) {
  this.errEmail = true
})
对此

.then((resp) => {
  this.errEmail = true
})
或手动绑定此

   .then(function (resp) {
      this.errEmail = true
    }.bind(this))

您需要为
then()
回调使用箭头函数,或函数中的
将引用函数本身,而不是Vue应用程序上下文。您需要为
then()
回调使用箭头函数,或函数中的
将引用函数本身,而不是Vue应用程序上下文。