<tap-toast>

轻量级提示组件。提供不同语义类型(info、success、warning、error、loading)、自定义操作按钮以及命令式静态方法调用。

Example

命令式调用

import { Toast } from '@mantou/tap-ui/elements/toast';

Toast.open('success', '这是一条消息');

Toast.open({
  type: 'info',
  content: '支持操作按钮',
  action: {
    text: '撤销',
    handle: () => console.log('undo'),
  },
});

// 返回关闭函数,`duration: Infinity` 时一直显示直到手动关闭
const close = Toast.open({ type: 'loading', content: '加载中…', duration: Infinity });
close();

API

Shadow DOM; Extends GemElement

Static Properties

Property Type
instance TapToastElement | undefined

Static Methods

Method Type
open { (options: ToastOptions): () => void; (type: Type, content: string | TemplateResult): () => void; }

Instance Properties

Property(Attribute) Reactive Type
items Yes ToastItem[]

Other

Type Value
Part item, icon, body, action