mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
47 lines
1.1 KiB
TypeScript
47 lines
1.1 KiB
TypeScript
import Vue from 'vue';
|
|
import { VanPopupMixin } from './mixins/popup';
|
|
|
|
type ToastMessage = string | number;
|
|
|
|
export type ToastOptions = {
|
|
type?: string;
|
|
mask?: boolean;
|
|
position?: string;
|
|
duration?: number;
|
|
className?: any;
|
|
onClose?(): void;
|
|
forbidClick?: boolean;
|
|
loadingType?: string;
|
|
message?: ToastMessage;
|
|
getContainer?: string | (() => HTMLElement);
|
|
};
|
|
|
|
export interface VanToast extends Vue, VanPopupMixin {
|
|
type: string;
|
|
position: string;
|
|
loadingType: string;
|
|
forbidClick: boolean;
|
|
message: ToastMessage;
|
|
clear(): void;
|
|
}
|
|
|
|
export interface Toast {
|
|
(message: ToastOptions | ToastMessage, options?: ToastOptions): VanToast;
|
|
loading(options?: ToastOptions | ToastMessage): VanToast;
|
|
success(options?: ToastOptions | ToastMessage): VanToast;
|
|
fail(options?: ToastOptions | ToastMessage): VanToast;
|
|
clear(): void;
|
|
install(): void;
|
|
setDefaultOptions(options: ToastOptions): void;
|
|
resetDefaultOptions(): void;
|
|
allowMultiple(allow: boolean): void;
|
|
}
|
|
|
|
declare module 'vue/types/vue' {
|
|
interface Vue {
|
|
$toast: Toast;
|
|
}
|
|
}
|
|
|
|
export const Toast: Toast;
|