message.d.ts
1.84 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
import Vue, {VNode} from 'vue'
export type MessageType = 'success' | 'warning' | 'info' | 'error'
/** Message Component */
export declare class ElMessageComponent extends Vue {
/** Close the Loading instance */
close (): void
}
export interface CloseEventHandler {
/**
* Triggers when a message is being closed
*
* @param instance The message component that is being closed
*/
(instance: ElMessageComponent): void
}
/** Options used in Message */
export interface ElMessageOptions {
/** Message text */
message: string | VNode
/** Message type */
type?: MessageType
/** Custom icon's class, overrides type */
iconClass?: string
/** Custom class name for Message */
customClass?: string
/** Display duration, millisecond. If set to 0, it will not turn off automatically */
duration?: number
/** Whether to show a close button */
showClose?: boolean
/** Whether to center the text */
center?: boolean
/** Whether message is treated as HTML string */
dangerouslyUseHTMLString?: boolean
/** Callback function when closed with the message instance as the parameter */
onClose?: CloseEventHandler
}
export interface ElMessage {
/** Show an info message */
(text: string): ElMessageComponent
/** Show message */
(options: ElMessageOptions): ElMessageComponent
/** Show a success message */
success (text: string): ElMessageComponent
/** Show a warning message */
warning (text: string): ElMessageComponent
/** Show an info message */
info (text: string): ElMessageComponent
/** Show an error message */
error (text: string): ElMessageComponent
}
declare module 'vue/types/vue' {
interface Vue {
/** Used to show feedback after an activity. The difference with Notification is that the latter is often used to show a system level passive notification. */
$message: ElMessage
}
}