首页 > 其他 > 详细

快捷键操作

时间:2020-02-03 11:11:44      阅读:60      评论:0      收藏:0      [点我收藏+]
public async mounted() {
const that = this as any;
document.addEventListener("keydown", this.WindowKeyDown);
}

  

  destroyed() {
    this.removeEventListenerkeydown();
  }

  

  public removeEventListenerkeydown() {
    document.removeEventListener("keydown", this.WindowKeyDown);
  }

  

  public async WindowKeyDown(e) {
    let that = this as any;
    let data = that.$data;
    if (e && e.keyCode == 27) { // 按 Esc      //要做的事情            
 
       //   this.closeForm();  //关闭
    }
    if (e.keyCode == 67 && (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)) {
   
      // this.resetForm(‘zyjs_accept_preget‘); //清空
    }
    if (e.keyCode == 69 && (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)) {
 
      //     this.clickOutPut(); //
    }
    if (e.keyCode == 81 && (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)) {
      e.preventDefault();   //ctrl+Q
      this.submit();
    }
  }

  

快捷键操作

原文:https://www.cnblogs.com/LFxanla/p/12254643.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!