Skip to content

Instantly share code, notes, and snippets.

@djirdehh
Created January 23, 2021 23:26
Embed
What would you like to do?
<template>
<div>
<input v-model="number" type="number" />
<button @click="addNumber">Add new number</button>
</div>
</template>
<script>
import { emitter } from "../event-bus.js";
export default {
name: "NumberSubmit",
data() {
return {
number: 0,
};
},
methods: {
addNumber(newNumber) {
emitter.emit("number-added", Number(this.number));
},
},
};
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment