How to trigger Enter key event inside a method?



I have this:

<p @click="code">Click</p>

In code() method, I want to do some work, and in the last step I want to trigger the Enter key event.

How to achieve this?


You can create your Enter event function as a method and reuse it in your code() function. Perhaps you can show how you register your Enter event first so we have clearer idea on how you trigger your enter event.


Thank you @chenxeed
Here is a link to the same question on StackOverflow with a live demo: