1.在页面初始化 全局监听
window.addEventListener('keydown', this.handGetCtrl);
2.键盘按下的事件
// 同时按下 ctrl+p 触发的函数 handGetCtrl:function(e){ // 检查是否同时按下了Ctrl键和P键 if (e.ctrlKey && e.key === 'p') { this.handGetLog() console.log('11') } // }; },
1.在页面初始化 全局监听
window.addEventListener('keydown', this.handGetCtrl);
2.键盘按下的事件
// 同时按下 ctrl+p 触发的函数 handGetCtrl:function(e){ // 检查是否同时按下了Ctrl键和P键 if (e.ctrlKey && e.key === 'p') { this.handGetLog() console.log('11') } // }; },