-
Notifications
You must be signed in to change notification settings - Fork 789
/
Copy pathMessageBox.vue
48 lines (44 loc) · 1.16 KB
/
MessageBox.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
<template>
<dialog
:open="isShow"
class="modal invisible"
>
<div
ref="dialogBoxRef"
class="modal-box"
>
<h3 class="text-lg font-bold">{{ title }}</h3>
<p class="py-4">{{ content }}</p>
<div class="modal-action">
<form method="dialog">
<button
@click="handleCancel"
class="cancel btn"
>
{{ cancelBtnText }}
</button>
</form>
<button
v-if="confirmBtnText"
class="confirm btn"
@click="handleConfirm"
>
{{ confirmBtnText }}
</button>
</div>
</div>
</dialog>
</template>
<script setup lang="ts">
import type { EmitsType, IMessageBoxProps } from "~/composables/messageBox/modal";
import { useMessageBoxModal } from "~/composables/messageBox/modal";
const props = withDefaults(defineProps<IMessageBoxProps>(), {
isShowModal: false,
title: "提示",
content: "你确定吗?",
confirmBtnText: "确定",
cancelBtnText: "取消",
});
const emits = defineEmits<EmitsType>();
const { dialogBoxRef, isShow, handleConfirm, handleCancel } = useMessageBoxModal(props, emits);
</script>