[Vuejs]-How to add keydown event in element-ui table?

0👍

Thanks all. Here, my req is to monitor Shift keydown event, to implement batch rows selection in a table. That’s why I wanna find keydown event for table. However, el-table has not the event. So, I find we need to implement it in the document element.

created:function(){
  document.onkeydown=function(e){
    var key=window.event.keyCode;
    if(key==16){
      alert('Shift down')
    }
  }
  document.onkeyup=function(e){
    var key=window.event.keyCode;
    if(key==13){
      alert('Enter up')
    }
  }
},

Leave a comment