xwt
2025-07-17 66f29ab451014ca2e72fa9a5ff6373ab507ff67c
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
import { VanComponent } from './component';
 
type DialogAction = 'confirm' | 'cancel';
type DialogDone = (close?: boolean) => void;
 
export type DialogOptions = {
  title?: string;
  width?: string | number;
  message?: string;
  theme?: string;
  overlay?: boolean;
  className?: any;
  allowHtml?: boolean;
  lockScroll?: boolean;
  transition?: string;
  messageAlign?: string;
  overlayClass?: string;
  overlayStyle?: object;
  closeOnPopstate?: boolean;
  cancelButtonText?: string;
  cancelButtonColor?: string;
  confirmButtonText?: string;
  confirmButtonColor?: string;
  showConfirmButton?: boolean;
  showCancelButton?: boolean;
  closeOnClickOverlay?: boolean;
  getContainer?: string | (() => Element);
  beforeClose?: (action: DialogAction, done: DialogDone) => void;
};
 
export interface Dialog {
  (options: DialogOptions): Promise<DialogAction>;
  alert(options: DialogOptions): Promise<DialogAction>;
  confirm(options: DialogOptions): Promise<DialogAction>;
  close(): void;
  install(): void;
  setDefaultOptions(options: DialogOptions): void;
  resetDefaultOptions(): void;
  Component: typeof VanComponent;
}
 
declare module 'vue/types/vue' {
  interface Vue {
    $dialog: Dialog;
  }
}
 
export const Dialog: Dialog;