-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathModalDialog.vue
67 lines (65 loc) · 1.94 KB
/
ModalDialog.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<template>
<div>
<div
v-if="showModal"
class="overflow-x-hidden overflow-y-auto fixed inset-0 z-50 outline-none focus:outline-none justify-center items-center flex"
>
<div class="relative w-auto my-6 mx-auto max-w-3xl">
<!--content-->
<div
class="border-0 rounded-lg shadow-lg relative flex flex-col w-full bg-white outline-none focus:outline-none"
>
<!--header-->
<div
class="flex items-start justify-between p-5 border-b border-solid border-slate-200 rounded-t"
>
<h3 class="text-3xl font-semibold">
{{ header }}
</h3>
<button
class="p-1 ml-auto bg-transparent border-0 text-black opacity-5 float-right text-3xl leading-none font-semibold outline-none focus:outline-none"
@click="showModal = false"
>
<span
class="bg-transparent text-black opacity-5 h-6 w-6 text-2xl block outline-none focus:outline-none"
>
×
</span>
</button>
</div>
<!--body-->
<div class="relative p-6 flex-auto">
<slot></slot>
</div>
<!--footer-->
<slot name="footer">
<div
class="flex items-center justify-end p-6 border-t border-solid border-slate-200 rounded-b"
>
<UButton @click="showModal = false"> Close </UButton>
</div>
</slot>
</div>
</div>
</div>
<div
v-if="showModal"
class="opacity-25 fixed inset-0 z-40 bg-black"
></div>
</div>
</template>
<script setup lang="ts">
const props = defineProps<{
modelValue: boolean
header: string
}>()
const emit = defineEmits(['update:modelValue'])
const showModal = computed({
get() {
return props.modelValue
},
set(value) {
emit('update:modelValue', value)
},
})
</script>