From: http://blog.csdn.net/u014520745/article/details/71746343
Only for learning, not for business!!!
vue can't use El input of element UI to listen to the carriage return event. The reason is that the original event is hidden after the element UI itself encapsulates a layer of input tag. Therefore, the following code runs unresponsive:
<el-input v-model="form.loginName" placeholder="Account number" @keyup.enter="doLogin"></el-input>
- 1
The solution needs to add. native after the event
<el-input v-model="form.loginName" placeholder="Account number" @keyup.enter.native="doLogin"></el-input>
Add keyboard events to normal input tags written by yourself
When pressing the keyboard, execute the show method, and then execute the corresponding business.
The effect of both input s is the same. If you press the 13 key, enter will pop up!!
@keyup.13 enter
@keyup.enter enter enter
@keyup.left left
@Right key
@keyup.up
@keyup.down
@keyup.delete delete
Original link: http://www.cnblogs.com/zycbloger/p/6423132.html