[new feature] Toast: add onClose prop (#2964)

This commit is contained in:
neverland
2019-03-13 20:16:39 +08:00
committed by GitHub
parent a4eedac8b1
commit 2e7ca412ff
5 changed files with 26 additions and 5 deletions

7
types/toast.d.ts vendored
View File

@@ -9,6 +9,7 @@ export type ToastOptions = {
position?: string;
duration?: number;
className?: any;
onClose?(): void;
forbidClick?: boolean;
loadingType?: string;
message?: ToastMessage;
@@ -23,7 +24,7 @@ export interface VanToast extends Vue, VanPopupMixin {
clear(): void;
}
export interface Toast {
export interface IToast {
(message: ToastOptions | ToastMessage, options?: ToastOptions): VanToast;
loading(options?: ToastOptions | ToastMessage): VanToast;
success(options?: ToastOptions | ToastMessage): VanToast;
@@ -37,8 +38,8 @@ export interface Toast {
declare module 'vue/types/vue' {
interface Vue {
$toast: Toast
$toast: IToast
}
}
export const Toast: Toast;
export const Toast: IToast;