const directives = {
  // 图片懒加载
  lazyImg: {
    mounted(el, binding) {
      const observer = new IntersectionObserver(entries => {
        if (entries[0].isIntersecting) {
          el.src = binding.value
          observer.unobserve(el)
        }
      })
      observer.observe(el)
    }
  }
}

export default directives
