[autofix.ci] apply automated fixes

This commit is contained in:
autofix-ci[bot] 2024-03-24 17:54:31 +00:00 committed by GitHub
parent 6a32dc1c9e
commit 932d143688
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,32 +1,32 @@
import { ref, onMounted, onUnmounted, defineComponent } from 'vue';
import { defineComponent, onMounted, onUnmounted, ref } from 'vue'
export default defineComponent({
setup(props, { emit }) {
const intersectionTarget = ref(null);
let observer = null;
setup (props, { emit }) {
const intersectionTarget = ref(null)
let observer = null
const intersectionCallback = (entries) => {
entries.forEach(entry => {
entries.forEach((entry) => {
if (entry.isIntersecting) {
emit('intersect');
observer.unobserve(entry.target);
emit('intersect')
observer.unobserve(entry.target)
}
});
};
})
}
onMounted(() => {
observer = new IntersectionObserver(intersectionCallback);
observer.observe(intersectionTarget.value);
});
observer = new IntersectionObserver(intersectionCallback)
observer.observe(intersectionTarget.value)
})
onUnmounted(() => {
if (observer) {
observer.disconnect();
observer.disconnect()
}
});
})
return {
intersectionTarget
};
}
}
});
})