I need to implement the use of keypu.enter
in a custom input component within Vue. I want the <input />
element in this component to trigger a function in the parent component when the enter key is pressed during typing.
This is the code for the custom input component:
<input v-on:keyup.enter="$emit('keyup')"/>
Next, here is the code for the main page:
<template>
<se-input @keyup="function()"/>
</template>
<script>
import inputField from '../components/inputfield.vue'
export default {
name: 'inputField',
components: {
'custom-input': inputField
},
},
methods: {
function () {
// Function
}
}
}
</script>