在使用键盘监听键盘事件时直接绑定没有任何反应。  


直接在生命周期中进行绑定就可以了。

created:function(){
let _this = this;
document.onkeydown = function(e){
let _key = window.event.keyCode;
if(_key === 13){
_this.login(1);
}
}
},

Logo

Vue社区为您提供最前沿的新闻资讯和知识内容

更多推荐