• layer 弹窗使用说明


    1、参考

    layer.msg参数含义及参数icon数字参数说明

    2、代码

    <!DOCTYPE html>
    <html lang="zh" xmlns:th="http://www.thymeleaf.org">
    <head>
        <meta charset="UTF-8">
        <title>layer</title>
    </head>
    <body>
    <div style="margin-left: 50px;">
        <input type="button" value="layerOpen" onclick="layerOpen()"> <br>
        <input type="button" value="showConfirm" onclick="showConfirm()"> <br>
        <input type="button" value="showOk" onclick="showOk()"> <br>
        <input type="button" value="showError" onclick="showError()"> <br>
    </div>
    </body>
    <script type="text/javascript" th:src="@{/js/jquery.min.js}"></script>
    <script type="text/javascript" th:src="@{/js/plugins/layer/layer.min.js}"></script>
    <script th:inline="javascript"> let ctx = [[@{/}]]; </script>
    <script type="text/javascript">
        $(function () {
    
        });
    
        function showOk() {
            layer.msg("<span style='color: #000'>成功</span>", {icon: 1, time: 2000});
        }
    
        function showError() {
            layer.msg("<span style='color: #000'>失败</span>", {icon: 2, time: 2000});
        }
    
        function showConfirm() {
            layer.confirm('是否执行动作?', {
                icon: 3,
                title: '执行动作',
                btn: ['确定', '取消'], //按钮
                anim: 2,
                offset: '100px'
            }, function () {
                layer.msg("<span style='color: #000'>执行成功</span>", {icon: 1, time: 1500});
                // $.ajax({
                //     url: "/tcc/manage/strategySet/drawOrderDelete", type: "post",
                //     dataType: "json", data: {id: $(".id").text()},
                //     success: function (obj) {
                //         console.log("drawOrderDelete", obj);
                //         if (obj.code == 0) {
                //             parent.layer.msg("<span style='color: #000'>删除成功</span>", {icon: 1, time: 1500});
                //         } else {
                //             parent.layer.msg("<span style='color: #000'>删除失败</span>", {icon: 2, time: 1500});
                //         }
                //         parent.layer.close(index); //再执行关闭
                //     }
                // })
    
            });
        }
    
        function layerOpen() {
            let width = 800;
            let height = ($(window).height() - 20);
            layer.open({
                content: ctx + "/demo/openWindow",
                type: 2,
                area: [width + 'px', height + 'px'],
                fix: false,
                maxmin: true,
                shade: 0.3,
                title: "layerOpen",
                btn: ['确定', '清空', '删除', '关闭'],
                shadeClose: true,// 弹层外区域关闭
                yes: function (index, layero) {
                    // let iframeWin = layero.find('iframe')[0];
                    // iframeWin.contentWindow.drawOrderSubmit(index, layero);
                    // return false;
                }, btn2: function (index, layero) {
                    // let iframeWin = layero.find('iframe')[0];
                    // iframeWin.contentWindow.drawOrderClean(index, layero);
                    // return false;
                }, btn3: function (index, layero) {
                    // let iframeWin = layero.find('iframe')[0];
                    // iframeWin.contentWindow.drawOrderDelete(index, layero);
                    // return false;
                },
                cancel: function (index) {
                    return true;
                }
            });
        }
    </script>
    </html>
    
  • 相关阅读:
    map集合的见解、排序
    java mysql 数据类型对照
    spring 通过@Value 获取properties文件中设置了属性 ,与@Value # 和$的区别
    nginx中的超时设置,请求超时、响应等待超时等
    Linux配置多个Tomcat同时运行
    Socket TCP Server一个端口可以有多少个长连接?受到什么影响?linux最大文件句柄数量总结
    tomcat关闭后线程依然运行解决办法
    守护线程与非守护线程的区别
    SSM整合——spring4.*配置案例
    SSM事务——事务回滚如何拿到返回值
  • 原文地址:https://www.cnblogs.com/kikyoqiang/p/16352504.html
Copyright © 2020-2023  润新知