Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<template>
<div>
<p> Wrapper for a text input </p>
<input
type="text"
placeholder="Custom input!"
@change='customChange'
/>
</div>
</template>
<script>
export default {
setup (props, context) {
const customChange = (event) => {
context.emit("customChange", event.target.value)
}
return {
customChange
}
}
}
</script>
<!-- OR -->
<script>
export default {
setup (props, { emit }) {
const customChange = (event) => {
emit("customChange", event.target.value)
}
return {
customChange
}
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment