基于vue的,如果原生想用其实也差不多,改一点点就ok了
/*无视传值*/
<div @click="handleClickFile(file)" @touchstart="showMultiple(file,index)" @touchend="clearLoop(file)"></div>
js部分
data(){
return{
timer:null
}
}
showMultiple(item,index){
clearTimeout(this.timer)
//长按进入多选
this.timer = setTimeout(()=>{
console.log(1111111111)
},800)
},
clearLoop(){
clearTimeout(this.timer)
},