[Vuejs]-Cannot read property in vue.js issue how to fix?

1👍

It is better to pass the value of the prop to data items like this:

data(){
     return{
          form{
               id:null,
               birthplace:null
          }
     }
},
props:['user'],
created(){
     if(this.user){
          this.form.id = this.user.id;
          if(this.user.profile)
               this.form.birthplace = this.user.profile.birthplace,
     }
}

Leave a comment