mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 21:55:11 +00:00
[autofix.ci] apply automated fixes
This commit is contained in:
parent
e4c9940269
commit
5c300a4698
@ -1,4 +1,4 @@
|
||||
import { createStaticVNode, defineComponent, getCurrentInstance, h, onBeforeUnmount, onMounted, ref, createVNode } from 'vue'
|
||||
import { createStaticVNode, createVNode, defineComponent, getCurrentInstance, h, onBeforeUnmount, onMounted, ref } from 'vue'
|
||||
import type { Component, Ref, VNode } from 'vue'
|
||||
// import ClientOnly from '#app/components/client-only'
|
||||
import { useObserver } from '#app/utils'
|
||||
@ -7,23 +7,21 @@ import { useNuxtApp } from '#app/nuxt'
|
||||
|
||||
// todo find a better way to do it ?
|
||||
function elementIsVisibleInViewport (el: Element) {
|
||||
const { top, left, bottom, right } = el.getBoundingClientRect();
|
||||
const { innerHeight, innerWidth } = window;
|
||||
const { top, left, bottom, right } = el.getBoundingClientRect()
|
||||
const { innerHeight, innerWidth } = window
|
||||
return ((top > 0 && top < innerHeight) ||
|
||||
(bottom > 0 && bottom < innerHeight)) &&
|
||||
((left > 0 && left < innerWidth) || (right > 0 && right < innerWidth))
|
||||
}
|
||||
|
||||
|
||||
/* @__NO_SIDE_EFFECTS__ */
|
||||
export const createLazyIOClientPage = (componentLoader: Component) => {
|
||||
return defineComponent({
|
||||
inheritAttrs: false,
|
||||
setup (_, { attrs }) {
|
||||
|
||||
if (import.meta.server) {
|
||||
return h('div', {}, [
|
||||
h(componentLoader, attrs)
|
||||
h(componentLoader, attrs),
|
||||
])
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user