-
-
Save noaione/818ea08274a2e03975e64fd553274eb1 to your computer and use it in GitHub Desktop.
src/components/Dialogs/GenericDialog.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
<template> | |
<v-dialog | |
:model-value="model" | |
:fullscreen="$vuetify.display.mobile" | |
:height="$vuetify.display.mobile ? undefined : 'auto'" | |
:width="$vuetify.display.mobile ? undefined : '70vw'" | |
@after-leave="emit('close')"> | |
<v-card :loading="isLoading" height="100%" class="d-flex flex-column"> | |
<slot name="loader" /> | |
<v-toolbar color="transparent"> | |
<template v-if="slots.toolbarPrepend" #prepend> | |
<slot name="toolbarPrepend" /> | |
</template> | |
<template #append> | |
<v-btn icon @click="model = false"> | |
<i-mdi-close /> | |
</v-btn> | |
</template> | |
<v-toolbar-title> | |
{{ title }} | |
</v-toolbar-title> | |
</v-toolbar> | |
<v-card-subtitle v-if="subtitle" class="pb-3"> | |
{{ subtitle }} | |
</v-card-subtitle> | |
<v-divider /> | |
<slot /> | |
<v-divider v-if="slots.actions" /> | |
<v-card-actions | |
v-if="slots.actions" | |
class="d-flex align-center pa-3" | |
:class="{ | |
'justify-end': !$vuetify.display.mobile, | |
'justify-center': $vuetify.display.mobile | |
}"> | |
<slot name="actions" /> | |
</v-card-actions> | |
</v-card> | |
</v-dialog> | |
</template> | |
<script setup lang="ts"> | |
import { computed, defineProps, ref, useSlots } from 'vue'; | |
const props = defineProps<{ | |
modelValue: boolean; | |
title: string; | |
subtitle?: string; | |
isLoading?: boolean; | |
}>(); | |
const emit = defineEmits<{ | |
(e: 'close'): void; | |
}>(); | |
const slots = useSlots(); | |
const model = ref(props.modelValue); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment