Skip to content

Instantly share code, notes, and snippets.

@djirdehh
Created January 23, 2021 23:26
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
<template>
<div>
<h2>{{ numbers }}</h2>
</div>
</template>
<script>
import { emitter } from "../event-bus.js";
export default {
name: "NumberDisplay",
data() {
return {
numbers: [1, 2, 3],
};
},
created() {
emitter.on("number-added", (number) => {
this.numbers.push(number);
});
},
};
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment