Vue表单支持回车键自动提交

2486次阅读  |  发布于4年以前
created () {
    document.onkeydown = (e) => {
      if (window.event === undefined) {
        var key = e.keyCode
      } else {
        // eslint-disable-next-line no-redeclare
        var key = window.event.keyCode
      }
      if (key === 13) {
        this.submitForm()
      }
    }
  },

Copyright© 2013-2020

All Rights Reserved 京ICP备2023019179号-8