mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-01 00:00:29 +00:00
[autofix.ci] apply automated fixes
This commit is contained in:
parent
6a32dc1c9e
commit
932d143688
@ -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
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user