Answer the question
In order to leave comments, you need to log in
How to correctly wait for data in a vue component?
When downloading the application, the user is authorized. I take the user token from localStorage and send it to the server for data.
Further, in one of the components (the form for adding a comment), the user needs to fill in three fields: name, email and message. The email field is populated from his profile by default. Filled in like this:
data() {
name: '',
email: '',
message: ''
},
mounted() {
this.email = this.$store.state.user.email;
}
Answer the question
In order to leave comments, you need to log in
Why duplicate the store data in the component data? why not use mapState ?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question