-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathGlobalToast.vue
More file actions
65 lines (56 loc) · 1.28 KB
/
GlobalToast.vue
File metadata and controls
65 lines (56 loc) · 1.28 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
<template>
<!-- Toast提示 - 直接使用ActionRenderer中验证可用的样式 -->
<Teleport to="body">
<Transition name="action-toast">
<div v-if="toastState.show" class="action-toast" :class="toastState.type">
{{ toastState.message }}
</div>
</Transition>
</Teleport>
</template>
<script setup>
import { toastState } from '@/stores/toast'
</script>
<style scoped>
/* Toast样式 - 直接复制ActionRenderer中的样式 */
.action-toast {
position: fixed !important;
top: 20px !important;
left: 50% !important;
transform: translateX(-50%) !important;
padding: 12px 24px;
border-radius: 6px;
color: white;
font-size: 14px;
z-index: 99999 !important;
max-width: 400px;
text-align: center;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
pointer-events: none;
}
.action-toast.success {
background: #52c41a;
}
.action-toast.error {
background: #f5222d;
}
.action-toast.warning {
background: #faad14;
}
.action-toast.info {
background: #1890ff;
}
/* Toast动画 */
.action-toast-enter-active,
.action-toast-leave-active {
transition: all 0.3s ease;
}
.action-toast-enter-from {
opacity: 0;
transform: translateX(-50%) translateY(-20px);
}
.action-toast-leave-to {
opacity: 0;
transform: translateX(-50%) translateY(-20px);
}
</style>