- 生命周期函数创建之后,响应回车事件
created: function() { var _this = this; document.onkeydown = function(e) { //按下回车提交 let key = window.event.keyCode; //事件中keycode=13为回车事件 if (key == 13) { _this.append(); } }; },
- 事件方法
append: function() { alert("我是回车"); },
created: function() { var _this = this; document.onkeydown = function(e) { //按下回车提交 let key = window.event.keyCode; //事件中keycode=13为回车事件 if (key == 13) { _this.append(); } }; },
append: function() { alert("我是回车"); },
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。