回车键触发登录

直接上代码

created(){
    let that = this
    document.onkeypress = function(e) {
      var keycode = document.all ? event.keyCode : e.which;
      if (keycode == 13) {
        //that.handleSubmit();// 登录方法名
        that.$route.path == '/Login' ? that.handleSubmit() : '';
        return false;
      }
    }
  }

 

posted @ 2021-04-01 09:54  武向前  阅读(64)  评论(0)    收藏  举报