Vue 鼠标按下事件获取当前元素下标
tabIndex(target, nodeList) {for (let i = 0; i < nodeList.length; i++) {if (target === nodeList[i]) {return i;}}},//iview组件走光灯// 鼠标keyDown事件,暂停轮播事件,并切换到点击的这个页面mousedown(val) {// val.target为button元素,button的父元素是li标签(获取当前li标签的索引)let objData = val.target.parentNode.parentNode.children;this.targetIndex = this.tabIndex(val.target.parentNode, objData); //调用tabIndex方法,返回值便是元素下标// value(当前索引) = 鼠标按下的元素的索引值this.policeKey = this.targetIndex;},(https://img-/085518795.PNG#pic_center)