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(); } }