toast

功能描述

轻量级的消息弹窗提示

依赖的模块

快速使用

1.引用js和css文件

2.api方法

  toast({
     message:'参数'
  })

3.使用例子
普通
  function showToast() {
     toast({
            message:'我是toast'
     });
  }


 自定义
 function showCustomToast() {
          toast({
            message:'<font color="red">我是toast</font>'
          });
       } 

 带图
 function showImageToast() {
          toast({
            message:'<img style="width:30px;heigth:30px" src="xx.png"></img><font color="white">我是toast</font>'
          });


 ## 具体html
 <!DOCTYPE html>
    <html lang="zh">
       <head>
          <meta charset="UTF-8">
          <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
          <meta name="viewport" content="width=device-width, initial-scale=1.0">
          <link href="toast.css" rel="stylesheet" type="text/css">
          <title>toast</title>

       </head>
       <body>
           <div>
             <button onclick="showToast()">普通toast</button>
             <button onclick="showCustomToast()">自定义toast</button>
             <button onclick="showImageToast()">带图toast</button>
           </div>


        <script type="text/javascript" src="toast.js"></script>
        <script type="text/javascript">
          function showToast() {
                  toast({
                    message:'我是toast'
                  });
               }
               function showCustomToast() {
                  toast({
                    message:'<font color="red">我是toast</font>'
                  });
               }
               function showImageToast() {
                  toast({
                    message:'<img style="width:30px;heigth:30px" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAVBUlEQVR4Xu2dD3BV1Z3Hv7+bPJIAQiB5D+sfsLZs/YvYMgrJCxrrUsU/5D0t67r2n+2sdupW3VlH6drVOnbUdWeK27q1W912u26tWN4DUarTrlDyEhBTQXT9A2oFtMi7CQRFCEne/e3cl6QbgSTvz7n3nnvv781kYCbn/P58f+eT8+49955DkI8oIAqMqACJNqKAKDCyAgKIjA5RYBQFBBAZHqKAACJjQBQoTQGZQUrTTXqFRAEBJCSFljRLU0AAKU036RUSBQSQkBRa0ixNAQGkNN2kV0gUEEBCUmhJszQFBJDSdJNeIVFAAAlJoSXN0hQQQErTTXqFRAEBJCSFljRLU0AAKU036RUSBQSQkBRa0ixNAQGkNN2kV0gUEEBcKnRd+6r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MQC2IJg+MfN5HQDcI++wjAUC0jxj7LFC3ZVidRJEdXQ2XvTeWT/l9+QoIIOVrKBYCrIAAEuDiSmrlKyCAlK+hWAiwAgJIgIsrqZWvgABSvoZiIcAKCCABLq6kVr4CAkj5GoqFACsggAS4uJJa+QoIIOVrKBYCrIAAEuDiSmrlKyCAlK+hWAiwAgJIgIsrqZWvgABSvoZiIcAKCCABLq6kVr4CAkj5GoqFACsggAS4uJJa+QoIIOVrKBYCrIAAEuDiSmrlK/B/Rw27Mt5EXFoAAAAASUVORK5CYII="></img><font color="white">我是toast</font>'
                  });
               }
        </script>
       </body>
    </html>         

特别说明

toast中message参数支持html标签内容