[Vuejs]-Vue – Unable to Pass Data From Component to Parent with $emit Event

3πŸ‘

βœ…

The component emitting the event is the button and you are listening to the event on the scene component:

Change your App.vue like this :

<template>
  <div id="app" class="container">
    <scene ></scene>
    <buttons @navigate="navigateTo" ></buttons>
  </div>
</template>

<script>
import Scene from "./components/Scene.vue";
import Buttons from "./components/Buttons.vue";

export default {
  name: "app",
  methods: {
    navigateTo(dest) {
      console.log('received value', dest);
      this.selectedScene = dest;
    }
  },
  components: {
    Scene,
    Buttons
  }
};
</script>
<style scoped>
</style>
πŸ‘€M. Gara

Leave a comment