vue element UI在button按钮使用 @keyup.enter不生效

 如图所示,没效果。在按钮上绑定keyup事件,加上.native覆盖原有封装的keyup事件

解决办法

created () {
    document.onkeyup = e => {
      if (e.keyCode === 13 && e.target.baseURI.match(/login/)) {
        // 调用登录 验证方法
        this.submitForm()
      }
    }
  }

成功解决!

猜你喜欢

转载自blog.csdn.net/qq_26695613/article/details/131423253