使用setTimeout将touchmove等事件延时,可以提高性能。
在搜索功能中也可以使用函数节流
export function debounce(func, delay = 200) { let timer return function (...args) { if (timer) { clearTimeout(timer) } timer = setTimeout(() => { func.apply(this, args) }, delay) } }