I added jQuery Lazy to the mix, hoping it would help with performance. But it’s not working as expected. All the images load right away when the page opens.
But now nothing shows up at all. I’m pretty new to Vue and Airtable, and coding in general. Any tips or suggestions would be super helpful! I feel like I’m close, but missing something important.
I’ve dealt with similar image loading challenges in Vue projects. One approach that worked well for me was using the Vue 3 Composition API with a custom composable for lazy loading. Here’s a quick outline:
Create a useIntersectionObserver composable:
import { ref, onMounted, onUnmounted } from 'vue'
export function useIntersectionObserver(options = {}) {
const isIntersecting = ref(false)
let observer = null
onMounted(() => {
observer = new IntersectionObserver(([entry]) => {
isIntersecting.value = entry.isIntersecting
}, options)
})
onUnmounted(() => {
if (observer) observer.disconnect()
})
return { isIntersecting, observer }
}
hey, i had a similar issue. try using a vue-specific lazy loading library instead of jquery lazy. vue-lazyload works great with vue and is pretty easy to set up. just install it, import it in your main.js, and use v-lazy directive on your img tags. that should do the trick!