mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-26 07:32:01 +00:00
types: add stricter types
This commit is contained in:
parent
76f2f5dc4a
commit
d5bd5f8392
@ -102,7 +102,7 @@ export const createLazyEventClientPage = (componentLoader: Component) => {
|
||||
const nuxt = useNuxtApp()
|
||||
const instance = getCurrentInstance()!
|
||||
const isTriggered = ref(false)
|
||||
const events: string[] = attrs.loader ?? ['mouseover']
|
||||
const events: string[] = attrs.loader as string[] ?? ['mouseover']
|
||||
|
||||
const registeredEvents: (() => void)[] = []
|
||||
onMounted(() => {
|
||||
@ -112,8 +112,8 @@ export const createLazyEventClientPage = (componentLoader: Component) => {
|
||||
registeredEvents.forEach((remove) => remove())
|
||||
eventsMapper.delete(instance)
|
||||
}
|
||||
instance.vnode.el.addEventListener(event, handler)
|
||||
registeredEvents.push(() => instance.vnode.el.removeEventListener(event, handler))
|
||||
instance.vnode.el?.addEventListener(event, handler)
|
||||
registeredEvents.push(() => instance.vnode.el?.removeEventListener(event, handler))
|
||||
})
|
||||
eventsMapper.set(instance, registeredEvents)
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user