vue项目里登录界面实现回车登录
created() {
let that = this;
document.onkeydown =function(e){
e = window.event || e;
if(that.$route.path=='/login'&&(e.code=='Enter'||e.code=='enter')){//验证在登录界面和按得键是回车键enter
that.submitForm('loginForm');//登录函数
}
}
}