Can VUE replace carriage return events with Tab events?

topic description

projects use vue 2.x, element-ui
customers have a need: customers are used to using the enter key to switch the focus of the control on the page, and the customer wants to press the enter key on the keyboard to achieve the next component to get the focus and continue to operate (the user does not want to press the Tab key).

question:
how to achieve the following effect in vue: when a user presses the enter key on the keyboard, it is equivalent to the effect that he presses the Tab key on the keyboard.

sources of topics and their own ideas

the current solution is:

  1. add an array object to each page to maintain all the components on the page.
  2. set a ref= "XXX" reference above each text box and select box on the page.
  3. add the @ keyup.enter.native= "selectXXX" event above each text box and select box on the page to get the ref and focus of the next component.

do you have any better solutions? It is best to replace carriage return events globally without having to write these event control codes separately on each page.


I'm also looking for it, but I haven't found a good way at present.


does anyone know a good way


has the problem been solved? I now have the same demand image.png
, which requires me to enter the car to change the line and get down on my knees to ask for a way.


provides an idea for you to simulate the tab event trigger

when the enter event is triggered.
Menu