Vue监听回车事件
- 生命周期函数创建之后,响应回车事件
created: function() { var _this = this; document.onkeydown = function(e) { //按下回车提交 let key = window.event.keyCode; //事件中keycode=13为回车事件 if (key == 13) { _this.append(); } }; },
- 事件方法
append: function() { alert("我是回车"); },
本文来自博客园,作者:手可摘星辰/*,转载请注明原文链接:https://www.cnblogs.com/u-damowang1/p/12158394.html

浙公网安备 33010602011771号