2018-03-26 16:04:04 +08:00
|
|
|
import Vue from 'vue'
|
2018-08-01 18:51:38 +08:00
|
|
|
import { MandComponent } from './component'
|
2018-03-26 16:04:04 +08:00
|
|
|
|
|
|
|
|
export type DialogOptions = {
|
|
|
|
|
title?: string
|
|
|
|
|
content?: string
|
|
|
|
|
confirmText?: string
|
2019-04-29 21:53:54 +08:00
|
|
|
onCancel?: () => void
|
2018-03-26 16:04:04 +08:00
|
|
|
onConfirm?: () => void
|
2019-09-04 21:20:42 +08:00
|
|
|
onShow?: () => void
|
|
|
|
|
onHide?: () => void
|
2018-03-26 16:04:04 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type DialogAlertOptions = {
|
2018-07-23 18:53:30 +08:00
|
|
|
icon?: string,
|
|
|
|
|
closable?: boolean,
|
2018-03-26 16:04:04 +08:00
|
|
|
} & DialogOptions
|
|
|
|
|
|
|
|
|
|
export type DialogConfirmOptions = {
|
|
|
|
|
cancelText?: string
|
|
|
|
|
} & DialogAlertOptions
|
|
|
|
|
|
2018-07-23 18:53:30 +08:00
|
|
|
export type DialogSucceedOptions = {
|
|
|
|
|
cancelText?: string,
|
|
|
|
|
closable?: boolean,
|
|
|
|
|
} & DialogOptions
|
|
|
|
|
|
|
|
|
|
export type DialogFailedOptions = DialogSucceedOptions
|
|
|
|
|
|
2018-08-01 18:51:38 +08:00
|
|
|
export interface IDialog {
|
2018-03-26 16:04:04 +08:00
|
|
|
confirm(options: DialogConfirmOptions): Vue
|
|
|
|
|
alert(options: DialogAlertOptions): Vue
|
2018-07-23 18:53:30 +08:00
|
|
|
succeed(options: DialogSucceedOptions): Vue
|
|
|
|
|
failed(options: DialogFailedOptions): Vue
|
|
|
|
|
closeAll(): void
|
2018-03-26 16:04:04 +08:00
|
|
|
}
|
|
|
|
|
|
2018-08-01 00:52:11 +08:00
|
|
|
declare module 'vue/types/vue' {
|
|
|
|
|
interface Vue {
|
2018-08-01 18:51:38 +08:00
|
|
|
$dialog: IDialog
|
2018-08-01 00:52:11 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-08-01 18:51:38 +08:00
|
|
|
export class Dialog extends MandComponent {
|
|
|
|
|
static confirm(options: DialogConfirmOptions): Vue
|
|
|
|
|
static alert(options: DialogAlertOptions): Vue
|
|
|
|
|
static succeed(options: DialogSucceedOptions): Vue
|
|
|
|
|
static failed(options: DialogFailedOptions): Vue
|
|
|
|
|
static closeAll(): void
|
|
|
|
|
}
|