- 生命周期函數創建之后,響應回車事件
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刪除。