[Vuejs]-On a Keydown.enter event in input element within a child component is also calling a method that is defined in Parent Component

0👍

It is not clear where you’re adding the keydown event, but there 2 possible solutions:

1.Use a event modifier on the input to stop propagation

<input @keydown.enter.stop

2.Use the self event modifier on the parent component button

<button 
v-for="skill in skills" 
@click.self="addSkill(skill)" 
:value="skill.category">

  {{skill.skills}}

More about event modifiers here

Leave a comment