Answer the question
In order to leave comments, you need to log in
Why does it give an error when setting a property?
Good afternoon.
There is a feedback form on the site. Sending a request via axios.
It is necessary to display a window about successful sending after sending the request.
In data, I started the complete property, hung v-if on the block in the notification.
But for some reason there is an error
Cannot set property 'complete' of undefined
sendCart: function() {
axios.post('/sendMessage', {
name: this.name,
phone: this.phone,
mail: this.mail
},
)
.then(function (response) {
this.complete = true;
})
.catch(function (error) {
console.log(error)
});
},
data: function() {
return {
name: "",
phone: "",
mail: "",
complete: false
}
},
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question