1
0

feat: use withDefaults and defineOptions in Modal

This commit is contained in:
Dominik Pschenitschni 2024-06-15 16:38:00 +02:00
parent 20701ce07a
commit b1a8bbe760
No known key found for this signature in database
GPG Key ID: B257AC0149F43A77

View File

@ -66,41 +66,39 @@
</Teleport>
</template>
<script lang="ts">
export default {
inheritAttrs: false,
}
</script>
<script lang="ts" setup>
import CustomTransition from '@/components/misc/CustomTransition.vue'
import BaseButton from '@/components/base/BaseButton.vue'
import {ref, useAttrs, watchEffect} from 'vue'
import {useScrollLock} from '@vueuse/core'
const {
enabled = true,
overflow,
wide,
transitionName = 'modal',
variant = 'default',
} = defineProps<{
const props = withDefaults(defineProps<{
enabled?: boolean,
overflow?: boolean,
wide?: boolean,
transitionName?: 'modal' | 'fade',
variant?: 'default' | 'hint-modal' | 'scrolling',
}>()
}>(), {
enabled: true,
overflow: false,
wide: false,
transitionName: 'modal',
variant: 'default',
})
defineEmits(['close', 'submit'])
defineOptions({
inheritAttrs: false,
})
const attrs = useAttrs()
const modal = ref<HTMLElement | null>(null)
const scrollLock = useScrollLock(modal)
watchEffect(() => {
scrollLock.value = enabled
scrollLock.value = props.enabled
})
</script>