In the process of front-end project development, to optimize user experience, users can enter query conditions and press Enter to achieve the search effect. The implementation method is as follows:

El-input to listen for the keyboard state is @keyup.enter. Native, or @keyup.Enter if it is not an EL-input component.

<el-input @keyup.enter.native="search" v-model='form.searchAttr' ></el-input>

<input @keyup.enter="search" ></el-input>

In Vue, we have aliases for commonly used keys so that we don’t need to match keyCode and use aliases to listen for key events.

Its commonly used shortcut keys are shown in the figure below: