-
引入
<script src="https://cdn.bootcss.com/toastr.js/latest/js/toastr.min.js"></script> <link rel="stylesheet" type="text/css" href="https://cdn.bootcss.com/toastr.js/latest/css/toastr.min.css">
-
参数说明
参数配置:关闭警告框 toastr.clear([toast]); 获取当前警告框 toastr.active(); 刷新警告框 第二个参数为超时时间 toastr.refreshTimer(toast, 5000);
-
简单的使用
1 //错误消息提示,默认背景为浅红色 toastr.error("你有新消息了!"); 2 //警告消息提示,默认背景为橘黄色 toastr.warning("你有新消息了!"); 3 //成功消息提示,默认背景为浅绿色 toastr.success("你有新消息了!"); 4 //常规消息提示,默认背景为浅蓝色 toastr.info("你有新消息了!"); 5 //带标题的消息框 toastr.success("你有新消息了!","消息提示"); 6 //另一种调用方法 toastr["info"]("你有新消息了!","消息提示");
-
效果