confirmDialog.vue
1.71 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<script lang="ts" setup name="confirmDialog">
const props = defineProps({
visible: {
type: Boolean,
default: false,
},
type: {
type: String,
default: 'success'
},
msg: {
type: String,
default: ''
}
});
const dialogVisible = computed(() => {
return props.visible;
});
const emits = defineEmits([
"btnClick",
]);
const cancelDialog = () => {
emits("btnClick", 'cancel');
}
const submit = () => {
emits("btnClick", 'submit');
}
const dialogClose = () => {
emits("btnClick", 'cancel');
}
const imgSrc = computed(() => {
return new URL(`../../../assets/images/confirmType/${props.type}.png`, import.meta.url).href;
})
</script>
<template>
<el-dialog v-model="dialogVisible" title="规则详情" width="460" :modal="true" :close-on-click-modal="true"
destroy-on-close align-center @close="dialogClose">
<div class="content">
<img class="header-img" :src="imgSrc"></img>
<div class="title" v-html="msg"></div>
</div>
<div class="dialog-footer">
<el-button @click="cancelDialog">取消</el-button>
<el-button @click="submit" type="primary" v-preReClick>确定</el-button>
</div>
</el-dialog>
</template>
<style lang="scss" scoped>
.content {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
.header-img {
width: 126px;
height: 72px;
margin-bottom: 12px;
}
.title {
width: 364px;
font-size: 16px;
color: #212121;
text-align: center;
line-height: 24px;
font-weight: 400;
margin-bottom: 32px;
white-space: pre-line;
}
}
.dialog-footer {
width: 100%;
display: flex;
justify-content: center;
flex-direction: row;
margin-bottom: 12px;
}
</style>