Use lozad for lazy image loading

Ref: grouped-emoji-picker
This commit is contained in:
Tusooa Zhu 2021-10-07 23:23:58 -04:00
commit d9901d3914
No known key found for this signature in database
GPG key ID: 7B467EDE43A08224
5 changed files with 26 additions and 2 deletions

View file

@ -0,0 +1,13 @@
import lozad from 'lozad'
const LazyImageContainer = {
inserted (el) {
const images = el.querySelectorAll('img')
console.log(images.length)
el.$observer = lozad(images)
el.$observer.observe()
}
}
export default LazyImageContainer