[Vuejs]-Can't get component data initialization with prop value to work

0👍

this is merely speculation but I am guessing during the initialization of your child component, this.comanda in your parent component is empty, and thus it initializes cmd with empty array.

try setting

 mounted(){

   this.cmd = this.comanda 
 }

if this doesn’t work it means you are changing comanda variable in your parent so

return{
  cmd: this.comanda
}

doesn’t work, because this only sets cmd in the first initialization of the variable.

Leave a comment