2018-07-17 14:17:05 +08:00
import Vue , { VNode } from 'vue'
2017-10-17 16:36:12 +08:00
export type MessageType = 'success' | 'warning' | 'info' | 'error'
/** Message Component */
export declare class ElMessageComponent extends Vue {
/** Close the Loading instance */
2017-10-26 23:17:45 +08:00
close ( ) : void
2017-10-17 16:36:12 +08:00
}
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 */
2018-07-17 14:17:05 +08:00
message : string | VNode
2017-10-17 16:36:12 +08:00
/** 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
2017-10-18 18:31:03 +08:00
/** Whether to center the text */
center? : boolean
/** Whether message is treated as HTML string */
dangerouslyUseHTMLString? : boolean
2017-10-17 16:36:12 +08:00
/** 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
2019-04-04 15:32:18 +08:00
/** Show a success message with options */
success ( options : ElMessageOptions ) : ElMessageComponent
2017-10-17 16:36:12 +08:00
/** Show a warning message */
warning ( text : string ) : ElMessageComponent
2019-04-04 15:32:18 +08:00
/** Show a warning message with options */
warning ( options : ElMessageOptions ) : ElMessageComponent
2017-10-17 16:36:12 +08:00
/** Show an info message */
info ( text : string ) : ElMessageComponent
2019-04-04 15:32:18 +08:00
/** Show an info message with options */
info ( options : ElMessageOptions ) : ElMessageComponent
2017-10-17 16:36:12 +08:00
/** Show an error message */
error ( text : string ) : ElMessageComponent
2019-04-04 15:32:18 +08:00
/** Show an error message with options */
error ( options : ElMessageOptions ) : ElMessageComponent
2017-10-17 16:36:12 +08:00
}
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
}
}