Enter vue monitor keyboard events @ keyup.enter || @ keyup.enter.native

vue run for the v-on when the monitor keyboard events, add a special keyboard modifiers: \

<input v-on:keyup.13="submit">

vue also gives a very intimate common key alias, eliminating the need to remember keyCode ~ ~

The above code, you can also write:

<input v-on:keyup.enter="submit">

<input @keyup.enter="submit">

All keyboard Alias:

.enter 

.tab 

.Delete (capture "Delete" and "backspace" key) 

.esc 

.space 

.UP 

.down 

.left 

.right

There are some special function keys:

.ctrl 

.ALT 

.shift 

.meta (the window is a window system key, the key command is mac)

Alt + C:

<input @keyup.alt.67="doSth">

Ctrl + Click :

< Div @ click.ctrl = "doSth" > point I </ div >

note! ! ! If the packaging component, then such Element, this time using the keys need to add modifier .native

such as:

<el-input v-model="account" placeholder="请输入账号" @keyup.enter.native="search()"></el-input>

 

Guess you like

Origin www.cnblogs.com/fqh123/p/11082807.html