I have two event listeners on an input component(@input and @keyup.delete). I am using the @input listener to detect keys and handle their usage accordingly, while I want to also detect when a user taps the delete or backspace button, so that I can change the index in a pin field.
BaseInputField.vue
<template>
<div>
...
<input
...
:value="value"
@keyup.delete="$emit('delete-or-backspace-key-pressed')"
@input="$emit('input', $event.target.value)"
...
/>
...
</div>
</template>
ParentContainer.vue
<BaseInputField
...
@input="handleInput"
@delete-or-backspace-key-pressed="handleDeletion"
...
/>
The problem is that pressing the del or backspace button also triggers the @input event, and it's messing with my implementation.
I would appreciate help on preventing this behaviour without the use of Keycodes, as according to Vue documentation, they are deprecated and may not work with newer browsers.