-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
ToastMixin.ts
65 lines (63 loc) · 1.38 KB
/
ToastMixin.ts
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
import { ComponentOptionsMixin } from 'vue-demi'
const ToastMixin: ComponentOptionsMixin = {
props: {
/**
* The id of the toast
*/
id: {
type: String,
required: true,
},
/**
* The index of the toast in the current queue
*/
index: {
type: Number,
required: true,
},
/**
* Whether the width of the window is smaller than the specified width or not.
*/
full: {
type: Boolean,
required: true,
},
/**
* The type of the toast
* Accepts: "base", "warning", "error", "success"
*/
type: {
type: String,
required: false,
default: 'base',
validator: (x: string) =>
['base', 'warning', 'error', 'success'].includes(x),
},
/**
* The current position from the parent plugin options
* Accepts: "bottom-right", "bottom-left", "top-right", "top-left", "top-middle", "bottom-middle"
*/
position: {
type: String,
required: false,
default: 'bottom-right',
validator: (x: string) =>
[
'bottom-right',
'bottom-left',
'top-right',
'top-left',
'top-middle',
'bottom-middle',
].includes(x),
},
/**
* The message to show on the toast
*/
message: {
type: String,
required: true,
},
},
}
export default ToastMixin