1、监听方法

// 监听键盘keyDown() {document.onkeydown = (e) => {//事件对象兼容let e1 = e || event || window.event || arguments.callee.caller.arguments[0]//键盘按键判断:左箭头-37;上箭头-38;右箭头-39;下箭头-40//左if (e1 && e1.keyCode == 37) {// 按下左箭头EventBus.$emit('LookBackOne',this.selectConcept.id)} else if (e1 && e1.keyCode == 39) {// 按下右箭头EventBus.$emit('LookNextOne',this.selectConcept.id)}}},

2、在mounted 钩子函数中调用

this.keyDown()

3、组合建

if (e1.ctrlKey && e1.keyCode == 37) {// 按下(ctrl+左)箭头EventBus.$emit('LookBackOne',this.selectConcept.id)} else if (e1.ctrlKey && e1.keyCode == 39) {// 按下(ctrl+右)箭头EventBus.$emit('LookNextOne',this.selectConcept.id)}

键盘keyCode:https://www.toptal.com/developers/keycode/for/arrow-left