How does vue add a carriage return event to a page?

how to add a carriage return event to a page by vue

is a business similar to enter login.
at the beginning, add keyup to the input of the form to listen to enter, < el-input VMI model = "form.phone" @ keyup.enter.native= "queryList ("isCheck")" > < / el-input > (here using elementUI)
but this method requires focus in the input box, but after the media, sales, date selector is selected, the focus is not on the above, keyup is useless.
after entering the query form, can you enter the enter event to query the list even if the focus is no longer in the form?
ask for communication!

Mar.12,2021

you can add an event that listens to the enter in the root component, then broadcast the event, and then listen to the event broadcast by the root component in your business component, so you can get the enter.


bind an @ keyup.enter.native event to el-form


so far, it seems that we can only add a listening document.onkeydown, in created to determine whether the form has a value, then send a request, and finally determine the position of the scroll bar, so as to prevent submission in other parts of the page

.
Menu