@nutui/nutui-react-taro
Version:
京东风格的轻量级移动端 React 组件库,支持一套代码生成 H5 和小程序
93 lines (92 loc) • 2.28 kB
TypeScript
import { default as React, FunctionComponent } from 'react';
import { BasicComponent } from '../../utils/typings';
export type ToastPosition = 'top' | 'bottom' | 'center';
export type ToastSize = 'small' | 'base' | 'large';
export type ToastWordBreak = 'normal' | 'break-all' | 'break-word';
export interface ToastProps extends BasicComponent {
id?: string;
maskClassName?: string;
/**
* 自定义内容区类名
* @default -
*/
contentClassName?: string
/**
* 自定义内容区样式
* @default -
*/
contentStyle?: React.CSSProperties
/**
* 自定义图标,对应icon组件,支持图片链接
* @default -
*/
icon: React.ReactNode
iconSize: string;
/**
* 消息文本内容
* @default -
*/
content: React.ReactNode
/**
* 展示时长(秒),值为 0 时,toast 不会自动消失(loading类型默认为0)
* @default 2
*/
duration: number
/**
* toast展示位置
* @default center
*/
position?: ToastPosition
/**
* 弹框类型 可选值(text、success、fail、warn、loading)
* @default -
*/
type: string
/**
* 标题
* @default -
*/
title: string
/**
* 是否在点击遮罩层后关闭提示
* @default false
*/
closeOnOverlayClick: boolean
/**
* 背景是否锁定
* @default false
*/
lockScroll: boolean
/**
* 文案尺寸,三选一
* @default base
*/
size: ToastSize
/**
* 弹窗是否显示开关
* @default false
*/
visible: boolean
/**
* 换行截断方式
* @default break-all
*/
wordBreak?: ToastWordBreak
/**
* 关闭时触发的事件
* @default null
*/
onClose: () => void
/**
* @deprecated Please use `content` prop instead.
*/
msg: React.ReactNode;
}
export declare const Toast: FunctionComponent<Partial<ToastProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'content'>> & {
show: typeof show;
hide: typeof hide;
};
export interface ToastOptions extends Partial<Omit<ToastProps, 'visible'>> {
}
export declare function show(selector: string, options: ToastOptions): void;
export declare function hide(selector: string): void;