import dialogSvc from 'ele-dialogsvc';
const modal = dialogSvc.open(<div>message</div>, {
title: 'hello world',
parent: '',
});
modal.result.then(
(result) => {
console.log(result);
},
(reason) => {
console.log(reason);
},
);
dialogSvc.alert({
title: 'hello world',
message: 'alert message',
});
dialogSvc.alert({
title: 'hello world',
message: <div style="color:red">alert message</div>,
});
dialogSvc
.confirm({
title: 'hello world',
message: 'confirm message',
})
.result.then(
(result) => {
console.log(result);
},
(reason) => {
console.log(reason);
},
);
interface ModalOptions {
title?: string;
fullscreen?: boolean;
modal?: boolean;
modalAppendToBody?: boolean;
appendToBody?: boolean;
lockScroll?: boolean;
customClass?: boolean;
closeOnClickModal?: boolean;
closeOnPressEscape?: boolean;
message?: any;
showClose?: boolean;
center?: boolean;
parent?: Vue;
beforeClose?: Callback;
}
interface ModalService {
open: (content: VNode | Component, options: ModalOptions | void) => ModalRef;
dismissAll: (reason: any) => void;
hasOpenModals: () => boolean;
alert: (options: ModalOptions) => ModalRef;
confirm: (options: ModalOptions) => ModalRef;
}
interface ModalRef {
id: number;
context: Vue;
result: Promise<any>;
close: (result: any) => void;
dismiss: (reason: any) => void;
options: ModalOptions;
}