[Vuejs]-How to share data between two component in vuejs with Event Bus

0👍

In your template you are referencing commandes

<tr v-for="(commande, index) in commandes" :key="index">

but your data doesn’t return it, it returns commande

data() {
   return {
    commande: [],
   }
}

Update your data and bus listeners:

data() {
   return {
    commandes: [],
   }
}

...

this.$eventBus.$on('commande', (commandes) => {
  this.commandes = commandes;
  console.log(commandes);
})

Leave a comment