Skip to content

通知系统组件 (Toast)

通知系统组件用于在页面上显示临时的消息提示。

使用示例

tsx
import { Toast } from "@/components/toast";

const MyComponent = () => {
  const showToast = () => {
    Toast.show('This is a toast message!');
  };

  return <button onClick={showToast}>Show Toast</button>;
}

方法

  • Toast.show(message: string, duration?: number) - 显示一条通知
  • Toast.hide() - 隐藏当前通知

配置

属性类型默认值描述
durationnumber3000通知显示时长(毫秒)

此文档使用cursor辅助生成,使用 VitePress 构建