mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[Improvement] Toast: type definition (#1468)
This commit is contained in:
parent
0753ab445c
commit
54d3277711
2
types/dialog.d.ts
vendored
2
types/dialog.d.ts
vendored
@ -1,5 +1,5 @@
|
|||||||
type DialogAction = 'confirm' | 'cancel';
|
type DialogAction = 'confirm' | 'cancel';
|
||||||
type DialogDone = (close: boolean) => void;
|
type DialogDone = (close?: boolean) => void;
|
||||||
|
|
||||||
export type DialogOptions = {
|
export type DialogOptions = {
|
||||||
title?: string;
|
title?: string;
|
||||||
|
23
types/toast.d.ts
vendored
23
types/toast.d.ts
vendored
@ -1,17 +1,30 @@
|
|||||||
|
import Vue from 'vue';
|
||||||
|
import { VanPopupMixin } from './mixins/popup';
|
||||||
|
|
||||||
|
type ToastMessage = string | number;
|
||||||
|
|
||||||
export type ToastOptions = {
|
export type ToastOptions = {
|
||||||
type?: string;
|
type?: string;
|
||||||
mask?: boolean;
|
mask?: boolean;
|
||||||
message?: string;
|
|
||||||
position?: string;
|
position?: string;
|
||||||
duration?: number;
|
duration?: number;
|
||||||
forbidClick?: boolean;
|
forbidClick?: boolean;
|
||||||
|
message?: ToastMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface VanToast extends Vue, VanPopupMixin {
|
||||||
|
type: string;
|
||||||
|
position: string;
|
||||||
|
loadingType: string;
|
||||||
|
forbidClick: boolean;
|
||||||
|
message: ToastMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Toast {
|
export interface Toast {
|
||||||
(message: ToastOptions | string, options?: ToastOptions): void;
|
(message: ToastOptions | ToastMessage, options?: ToastOptions): VanToast;
|
||||||
loading(options?: ToastOptions | string): void;
|
loading(options?: ToastOptions | ToastMessage): VanToast;
|
||||||
success(options?: ToastOptions | string): void;
|
success(options?: ToastOptions | ToastMessage): VanToast;
|
||||||
fail(options?: ToastOptions | string): void;
|
fail(options?: ToastOptions | ToastMessage): VanToast;
|
||||||
clear(): void;
|
clear(): void;
|
||||||
install(): void;
|
install(): void;
|
||||||
setDefaultOptions(options: ToastOptions): void;
|
setDefaultOptions(options: ToastOptions): void;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user