mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 21:55:11 +00:00
fix: import type Ref and provide emit
This commit is contained in:
parent
2ac2a975e0
commit
d94436b9c4
@ -1,6 +1,8 @@
|
||||
import { defineComponent, onMounted, onUnmounted, ref } from 'vue'
|
||||
import type { Ref } from "vue"
|
||||
|
||||
export default defineComponent({
|
||||
emits: ['intersect'],
|
||||
setup (props, { emit }) {
|
||||
const intersectionTarget: Ref<Element | null> = ref(null)
|
||||
let observer: IntersectionObserver | null = null
|
||||
@ -9,7 +11,7 @@ export default defineComponent({
|
||||
entries.forEach((entry) => {
|
||||
if (entry.isIntersecting) {
|
||||
emit('intersect')
|
||||
observer.unobserve(entry.target)
|
||||
observer!.unobserve(entry.target)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user