vue實現快捷鍵


created() {
let arr = [];
let that = this;
document.onkeydown = function(e) {
if(arr.length > 0) { // a-z按鍵長按去重
if(arr.indexOf(e.key.toLowerCase()) >= 0) {
return
}
}
arr.push(e.key.toLowerCase())
this.keydown = arr.join('+');
if(this.keydown == 'shift+enter') {
this.keydown = '';
that.combineFile()
}
}
document.onkeyup = function (e) {
arr.splice(arr.indexOf( e.key.toLowerCase() ),1);
this.keydown = arr.join('+');
}
this.keydown = '';
}

  

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM