feat: client-io-component.ts barebones functionality

This commit is contained in:
Michael Brevard 2024-03-24 19:41:29 +02:00 committed by GitHub
parent d64d78fde8
commit 9ac1261662
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -0,0 +1,24 @@
import { defineComponent } from "vue"
export default defineComponent({
setup() {
const data = ref(null);
const isIntersecting = ref(false);
const target = ref(null);
let observer: Ref<IntersectionObserver | null> = ref(null)
onMounted(() => {
const observer = new IntersectionObserver(entries => {
entries.forEach(entry => {
if (entry.isIntersecting) {
isIntersecting.value = true;
observer.unobserve(target.value);
}
});
});
observer.observe(target.value);
});
return {
isIntersecting
};
}
});