vant/types/notify.d.ts
2019-05-30 12:00:47 +08:00

40 lines
812 B
TypeScript

import Vue from 'vue';
export type NotifyMessage = string | number;
export type NotifyOptions = {
value?: boolean;
color?: string;
message?: NotifyMessage;
duration?: number;
className?: any;
background?: string;
onClose?: (() => void) | null;
onClick?: ((event: Event) => void) | null;
}
export interface VanNotify extends Vue {
message: NotifyMessage;
color: string;
background: string;
duration: number;
}
export interface Notify {
(message: NotifyOptions | NotifyMessage): VanNotify;
clear(): void;
install(): void;
currentOptions: NotifyOptions;
defaultOptions: NotifyOptions;
setDefaultOptions(options: NotifyOptions): void;
resetDefaultOptions(): void;
}
declare module 'vue/types/vue' {
interface Vue {
$notify: Notify
}
}
export const Notify: Notify;