js get all the input box element to an input box home focus of the event

@keyup.native="tdItem.onKeyUp($event, trItem, trIndex)"
               ( item , row , index)   
 
// Get all input
let inputAll = document.querySelectorAll('.table_input input');
// = 38 upwardly keyboard
if ( item.keyCode === 38) {
newIndex -= 1;
if (inputAll[newIndex]) {
inputAll[newIndex].focus();
}
}
// Down keyboard = 40
if ( item.keyCode === 40) {
newIndex += 1;
if (inputAll[newIndex]) {
inputAll[newIndex].focus();
}
}

Guess you like

Origin www.cnblogs.com/wssdx/p/11122179.html