let telInput=document.querySelector("input") telInput.addEventListener('input',noDou(demo,1000)) //防抖封装 function noDou(fn,wait){ let timeOut=null; return args=>{ if(timeOut) clearTimeout(timeOut) timeOut=setTimeout(fn,wait) } }