// 防抖
export const debounce = (fn, delay) => {
  let time = null
  return function() {
    let context = this;//记录一下this指向
    let args = arguments;
    //清除定时任务
    if (time) clearTimeout(time);
    time = setTimeout(function() {
      time = null;
      fn.apply(context, args)
    }, delay)
  }
}
