mirror of
https://github.com/VueTubeApp/VueTube
synced 2024-11-18 01:05:13 +00:00
25 lines
502 B
Vue
25 lines
502 B
Vue
<template>
|
|
<div class="observer" style="height: 1px" />
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
props: ["options"],
|
|
data: () => ({
|
|
observer: null,
|
|
}),
|
|
mounted() {
|
|
const options = this.options || { threshold: 0.0 };
|
|
this.observer = new IntersectionObserver(([entry]) => {
|
|
if (entry && entry.isIntersecting) {
|
|
this.$emit("intersect");
|
|
}
|
|
}, options);
|
|
|
|
this.observer.observe(this.$el);
|
|
},
|
|
destroyed() {
|
|
this.observer.disconnect();
|
|
},
|
|
};
|
|
</script>
|