mirror of
https://github.com/nuxt/nuxt.git
synced 2025-03-04 06:25:36 +00:00
feat: provide an emit
This commit is contained in:
parent
9ac1261662
commit
84b0a71b8c
@ -1,5 +1,6 @@
|
|||||||
import { defineComponent } from "vue"
|
import { defineComponent } from "vue"
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
|
emits: ['intersected'],
|
||||||
setup() {
|
setup() {
|
||||||
const data = ref(null);
|
const data = ref(null);
|
||||||
const isIntersecting = ref(false);
|
const isIntersecting = ref(false);
|
||||||
@ -10,6 +11,7 @@ export default defineComponent({
|
|||||||
entries.forEach(entry => {
|
entries.forEach(entry => {
|
||||||
if (entry.isIntersecting) {
|
if (entry.isIntersecting) {
|
||||||
isIntersecting.value = true;
|
isIntersecting.value = true;
|
||||||
|
emit('intersected');
|
||||||
observer.unobserve(target.value);
|
observer.unobserve(target.value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user