Created
January 23, 2021 23:26
-
-
Save djirdehh/998f6397ff7ff62ff8877f1dd6430dc8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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