[Vuejs]-Click event on div to get innerText value and $emit with event-bus to another component not working

1👍

I believe you can simplify that a lot by changing your @click to be:

@click="getSingleBeer(product.id)"

Which should pass the id for you, so you can just do:

getSingleBeer(beerId) {
    eventBus.$emit("beer-id", beerId);
    this.$router.push({ name: "Beer" });
}

Leave a comment