cy-plugin-toast
v1.0.4
Published
移动端 弹窗
Readme
cy-plugin-toast
移动端弹窗
📦 安装
npm install cy-plugin-toast -save🦄 使用
// 基本使用方式
import toast from 'cy-plugin-toast';
import type { IToast } from 'cy-plugin-toast';
// 显示普通消息
toast.msg('这是一条普通消息');
// 显示成功消息
toast.success('操作成功');
// 显示警告消息
toast.warning('请注意');
// 显示错误消息
toast.error('操作失败');
// 显示自定义图标消息
toast.icon({
message: '自定义图标',
icon: '<svg>...</svg>'
});
// 自定义配置
toast.msg({
message: '自定义显示时间',
duration: 5000, // 显示5秒
onClose: () => {
console.log('Toast已关闭');
}
});
// 清空所有消息
toast.clear();