element 加载状态关闭的问题,为什么this.loading = false关闭不了

exhcangeBalance(){

        this.loading = true
        this.exchangeFrom.append('XAuthToken',3)
        this.exchangeFrom.append('voucher',this.jinEinput)
         this.$axios.post("http://localhost:8080/MeDesignMaster/account/voucherExchange",this.exchangeFrom)
        .then(response => {
            console.log(response)
            //点券
            this.designerAccountBalance = response.data.responseDataObject.designerAccountBalance
            this.loading = false
        })
        .catch(function(error) {
           this.loading = false
        });
    }
阅读 6.2k
3 个回答

可能失败了 进入catch分支了。由于catch里的函数没有使用箭头函数,所以这个this指向window

上html代码   和data(){return{
    loading:''
}}的代码

把this.loading = false 放在console上面

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题