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>
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.enter enter enter
Original link: http://www.cnblogs.com/zycbloger/p/6423132.html