add nova
This commit is contained in:
40
nova/resources/js/components/Backdrop.vue
Normal file
40
nova/resources/js/components/Backdrop.vue
Normal file
@@ -0,0 +1,40 @@
|
||||
<template>
|
||||
<div
|
||||
v-bind="$attrs"
|
||||
v-show="props.show"
|
||||
class="absolute inset-0 h-full"
|
||||
:style="{ top: `${scrollY}px` }"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted, onBeforeUnmount } from 'vue'
|
||||
|
||||
const props = defineProps({
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
})
|
||||
|
||||
const scrollY = ref()
|
||||
const scrollEvent = () => {
|
||||
scrollY.value = window.scrollY
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
scrollEvent()
|
||||
|
||||
document.addEventListener('scroll', scrollEvent)
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
document.removeEventListener('scroll', scrollEvent)
|
||||
})
|
||||
</script>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
inheritAttrs: false,
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user