• Layer弹窗消息封装,Layer消息提示封装,Layer使用


    ================================

    ©Copyright 蕃薯耀 2020-08-05

    https://www.cnblogs.com/fanshuyao/

    一、引入js(因为引用了layui,直接引入这个)

    <script type="text/javascript" src="../../static/plugin/layui-v2.5.6/layui.all.js"></script>

    二、提示封装

    写在公共的js里面,如common.js

    var layer = layui.layer;
    
    L = {};
    
    L.msg = function(msg){
        return layer.msg(msg);
    };
    
    L.fail = function(msg){
        return layer.alert(msg, {icon: 5, shade: 0.5});
    };
    
    L.failMsg = function(msg){
        return layer.msg(msg, {icon: 5});
        
    };
    
    L.ok = function(msg){
        return layer.alert(msg, {icon: 6, shade: 0.5});
    };
    
    L.okMsg = function(msg){
        return layer.msg(msg, {icon: 6});
    };
    
    
    L.alert = function(msg){
        return layer.alert(msg);
    };
    
    
    L.load = function(msg){
        return layer.msg((msg || "数据处理中,请等待…"), {
            icon : 16,
            shade : 0.2,
            time: 0//不关闭
        });
    };
    
    L.confirm = function(msg){
        return layer.msg((msg || "数据处理中,请等待…"), {
            icon : 16,
            shade : 0.2,
            time: 0//不关闭
        });
    };
    
    /*
    使用:
    aaa = function(){
        alert("bbbcc");
    };
    
    L.confirm("你确定?", aaa);
     */
    L.confirm = function(msg, callbackFunction){
        return layer.confirm((msg || "您确定要操作吗?"), {
                btn: ["确定", "关闭"] //按钮
            
            }, function(index, layero){
                callbackFunction();
                layer.close(index);
                
            }, function(index, layero){
                layer.close(index);
            });
    };

    ================================

    ©Copyright 蕃薯耀 2020-08-05

    https://www.cnblogs.com/fanshuyao/

  • 相关阅读:
    Excel Rendering Limitations
    Output Caching and VaryByParam, VaryByCustom
    ajaxToolkit:AutoCompleteExtender 使用键值对
    Sql Server 2005 存储过程分页
    WEB前端优化
    processModel Element in Machine.config
    如何监测虚拟内存
    MemoryLimit Tuning (ASP.NET v1.1)
    缓存之SqlDependency
    SQL产生随机字符串
  • 原文地址:https://www.cnblogs.com/fanshuyao/p/13438620.html
Copyright © 2020-2023  润新知