-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
318bf64
commit 7ab84df
Showing
4 changed files
with
468 additions
and
0 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
packages/design-system/src/components/OcSingleTile/OcSingleTile.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<template> | ||
<li ref="observerTarget" tabindex="-1"> | ||
<slot /> | ||
</li> | ||
</template> | ||
<script> | ||
import { customRef, computed, ref, unref } from 'vue' | ||
import { useIsVisible } from '../../composables' | ||
export default { | ||
name: 'OcSingeTile', | ||
status: 'ready', | ||
release: '1.0.0', | ||
setup(props) { | ||
const observerTarget = customRef((track, trigger) => { | ||
let $el | ||
return { | ||
get() { | ||
track() | ||
return $el | ||
}, | ||
set(value) { | ||
$el = value | ||
trigger() | ||
} | ||
} | ||
}) | ||
const lazyColspan = ref(null) | ||
if (props.lazy) { | ||
// lazyColspan.value = props.lazy.colspan | ||
} | ||
const { isVisible } = props.lazy | ||
? useIsVisible({ | ||
...props.lazy, | ||
target: observerTarget | ||
}) | ||
: { isVisible: ref(true) } | ||
const isHidden = computed(() => !unref(isVisible)) | ||
return { | ||
observerTarget, | ||
isHidden, | ||
lazyColspan | ||
} | ||
} | ||
} | ||
</script> |
Oops, something went wrong.