<el-button type="primary" @click="login">登录</el-button>
created() {
    this.keyupSubmit();
},
methods(){
   keyupSubmit() { 
      document.onkeydown = (e) => {
        let _key = window.event.keyCode;
        //!this.clickState是防止用户重复点击回车
        if (_key === 13&&!this.clickState) {
          this.login();
        }
      };
    },
}
Logo

前往低代码交流专区

更多推荐