mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
fix: avoid setting another mounted if instance is registered
This commit is contained in:
parent
5d5432cba7
commit
3727a435b5
@ -105,6 +105,7 @@ export const createLazyEventClientPage = (componentLoader: Component) => {
|
|||||||
const events: string[] = attrs.loader as string[] ?? ['mouseover']
|
const events: string[] = attrs.loader as string[] ?? ['mouseover']
|
||||||
|
|
||||||
const registeredEvents: (() => void)[] = []
|
const registeredEvents: (() => void)[] = []
|
||||||
|
if (!eventsMapper.has(instance)) {
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
events.forEach((event) => {
|
events.forEach((event) => {
|
||||||
const handler = () => {
|
const handler = () => {
|
||||||
@ -117,6 +118,7 @@ export const createLazyEventClientPage = (componentLoader: Component) => {
|
|||||||
})
|
})
|
||||||
eventsMapper.set(instance, registeredEvents)
|
eventsMapper.set(instance, registeredEvents)
|
||||||
})
|
})
|
||||||
|
}
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
registeredEvents?.forEach(remove => remove())
|
registeredEvents?.forEach(remove => remove())
|
||||||
eventsMapper.delete(instance)
|
eventsMapper.delete(instance)
|
||||||
|
Loading…
Reference in New Issue
Block a user