0
点赞
收藏
分享

微信扫一扫

toastr弹出提示窗口的使用

林塬 2022-02-11 阅读 138
  1. 引入

    <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">
    
  2. 参数说明
    参数配置:

    关闭警告框
    toastr.clear([toast]);
    
    获取当前警告框
    toastr.active();
    
    刷新警告框 第二个参数为超时时间
    toastr.refreshTimer(toast, 5000);
    
  3. 简单的使用

     1 //错误消息提示,默认背景为浅红色 
     toastr.error("你有新消息了!");
     
     2 //警告消息提示,默认背景为橘黄色 
     toastr.warning("你有新消息了!"); 
     
     3 //成功消息提示,默认背景为浅绿色 
     toastr.success("你有新消息了!"); 
     
     4 //常规消息提示,默认背景为浅蓝色  
     toastr.info("你有新消息了!");  
    
     5 //带标题的消息框
     toastr.success("你有新消息了!","消息提示");
      
     6 //另一种调用方法
     toastr["info"]("你有新消息了!","消息提示");
    
  4. 效果
    在这里插入图片描述

举报

相关推荐

0 条评论