[autofix.ci] apply automated fixes

This commit is contained in:
autofix-ci[bot] 2024-03-25 17:23:25 +00:00 committed by GitHub
parent f6ba2255e6
commit 1e16b4a088
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,14 +1,14 @@
import { defineComponent, h, ref, onMounted, onBeforeUnmount } from 'vue'
import type { Component, Ref } from "vue"
import { defineComponent, h, onBeforeUnmount, onMounted, ref } from 'vue'
import type { Component, Ref } from 'vue'
import ClientOnly from '#app/components/client-only'
import { useObserver } from "#app/utils"
import { useObserver } from '#app/utils'
export const createLazyIOClientPage = (componentLoader: Component) => {
return defineComponent({
inheritAttrs: false,
setup (_, { attrs }) {
const isIntersecting = ref(false);
const el: Ref<Element | null> = ref(null);
const isIntersecting = ref(false)
const el: Ref<Element | null> = ref(null)
let unobserve: (() => void) | null = null
onMounted(() => {
const observer = useObserver()
@ -17,7 +17,7 @@ export const createLazyIOClientPage = (componentLoader: Component) => {
unobserve?.()
unobserve = null
})
});
})
onBeforeUnmount(() => {
unobserve?.()
unobserve = null
@ -26,13 +26,13 @@ export const createLazyIOClientPage = (componentLoader: Component) => {
h(ClientOnly, undefined, {
default: () => {
if (isIntersecting.value) {
return h(componentLoader, attrs);
return h(componentLoader, attrs)
} else {
return null;
return null
}
}
})
]);
])
}
});
};
})
}