import { Component } from 'vue'; import { DialogProps as IProps } from '../types'; import { DialogWidthEnum } from './Dialog.const'; export interface DialogProps extends IProps { confirmText?: string; showConfirm?: boolean; cancelText?: string; showCancel?: boolean; loading?: boolean; contentClass?: string; closeOnPressEscape?: boolean; /** * url Popstate变化时关闭弹框 * @default true */ closeOnPopstate?: boolean; /** * 确认事件处理函数, * 返回true时,自动关闭 */ handleConfirm?: (extra?: any) => Promise | boolean; width?: keyof typeof DialogWidthEnum; alignCenter?: boolean; destroyOnClose?: boolean; showClose?: boolean; description?: string | Component; disabled?: boolean; /** 交换数据 */ extra?: any; } export type DialogValue = boolean; export interface DialogSlots { 'default': () => void; 'footer': (props: Pick & { onCancel: () => void; }) => void; 'footer-left': () => void; 'footer-right': () => void; /** * DOM触发 */ 'trigger': () => void; } export interface DialogEmits { (e: 'confirm'): void; (e: 'cancel'): void; (e: 'close'): void; (e: 'closed'): void; (e: 'beforeClose', value: () => void): void; (e: 'open'): void; (e: 'opened'): void; } export interface DialogExpose { open: () => void; close: () => void; }