029——VUE中键盘语义修饰符
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>键盘语义修饰符: </title> <script src="vue.js"></script> </head> <body> <div id="lantian"> <!--keyup 后面可以跟键盘的任何键。敲击相对应的键,就会执行绑定的事件--> <input type="text" @keyup.enter="keyEvent"> </div> <script> var app = new Vue({ el: '#lantian', data: { }, methods: { keyEvent(){ console.log('123'); } } }); </script> </body> </html>