-
Notifications
You must be signed in to change notification settings - Fork 1
/
App.vue
99 lines (93 loc) · 2.37 KB
/
App.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<template>
<div id="container">
<div id="buttons">
<dxButton
text="Show message"
@click="showMessage"
>
</dxButton>
<dxButton
text="Show custom message"
@click="showCustomMessage"
>
</dxButton>
</div>
<dxToast
v-model:visible="isVisible"
content-template="custom-template"
:width="230"
:height="50"
type="custom"
>
<DxPosition
my="bottom"
at="bottom"
of="#container"
/>
<template #custom-template>
<span>You have a new message </span>
<i class='dx-icon-email icon-style'></i>
</template>
</dxToast>
</div>
</template>
<script>
import { DxButton } from 'devextreme-vue/button';
import { DxToast, DxPosition } from 'devextreme-vue/toast';
import notify from "devextreme/ui/notify";
export default {
components: {
DxButton,
DxToast,
DxPosition
},
data() {
return {
types: ['error', 'info', 'success', 'warning'],
isVisible: false
};
},
methods: {
showMessage() {
notify(
{
message: "You have a new message",
width: 230,
position: {
at: "bottom",
my: "bottom",
of: "#container"
}
},
this.types[Math.floor(Math.random() * 4)],
500
);
},
showCustomMessage() {
this.isVisible = true;
}
}
}
</script>
<style>
#container {
width: 300px;
height: 120px;
margin: 5px;
}
#buttons {
display: flex;
}
.dx-toast-custom {
background-color: #F05B41;
color: white;
border-radius: 5px;
padding: 2px;
display: flex;
align-items: center;
justify-content: center;
}
.icon-style {
margin-top: 3px;
}
</style>