@tplc/wot
Version:
63 lines (62 loc) • 1.59 kB
TypeScript
import type { ExtractPropTypes } from 'vue'
import type { LoadingType } from '../wd-loading/types'
export type ToastIconType = 'success' | 'error' | 'warning' | 'loading' | 'info'
export type ToastPositionType = 'top' | 'middle' | 'bottom'
export type ToastLoadingType = LoadingType
export type ToastOptions = {
msg?: string
duration?: number
iconName?: ToastIconType
iconSize?: number
loadingType?: ToastLoadingType
loadingColor?: string
loadingSize?: number
iconColor?: string
position?: ToastPositionType
show?: boolean
zIndex?: number
/**
* 是否存在遮罩层
*/
cover?: boolean
/**
* 图标类名
*/
iconClass?: string
/**
* 类名前缀,用于使用自定义图标
*/
classPrefix?: string
/**
* 完全展示后的回调函数
*/
opened?: () => void
/**
* 完全关闭时的回调函数
*/
closed?: () => void
}
export interface Toast {
show(toastOptions: ToastOptions | string): void
success(toastOptions: ToastOptions | string): void
error(toastOptions: ToastOptions | string): void
info(toastOptions: ToastOptions | string): void
warning(toastOptions: ToastOptions | string): void
loading(toastOptions: ToastOptions | string): void
close(): void
}
export declare const toastProps: {
selector: {
type: import('vue').PropType<string>
default: string
}
customStyle: {
type: import('vue').PropType<string>
default: string
}
customClass: {
type: import('vue').PropType<string>
default: string
}
}
export type ToastProps = ExtractPropTypes<typeof toastProps>