• 前端开发


    layer用法

    1.layer提示框

    layer.msg("操作成功", {time:2000, icon:1}); //icon:0-2 
    

    2.ajax请求后成功刷新页面,失败提示信息(使用layer组件)

    $.ajax({
        type: "POST",
        data: json,
        contentType: 'application/json;charset=utf-8',
        url: "${ctx!}/admin/voucher/select/delete",
        success: function(msg){
            msg = JSON.parse(msg);
            if (msg.code == 0){
                layer.msg(msg.message, {icon:1, time: 2000}, function () {
                    window.location.reload();
                    //table.bootstrapTable("refresh");
                });
            } else {
                layer.msg(msg.message, {icon:2, time:2000})
            }
        }
    });
    

    3.layer确认框

    layer.confirm('是否确认删除?', {btn: ['确认','取消']},
        function(){
            $.ajax({
                type: "get",
                contentType: 'application/json;charset=utf-8',
                dataType: 'json',
                url: "${ctx!}/admin/warning/apply/del/" + id,
                success: function(msg){
                    if (msg.code == 0){
                        layer.msg(msg.message, {icon:1, time: 1000}, function () {
                            $table.bootstrapTable("refresh");
                            // window.location.reload();
                        });
                    } else {
                        layer.msg(msg.message, {icon:2, time:1000})
                    }
                }
            });
        },
        function () {
        }
    );
    

    4.layer中打开网页

    layer.open({
        type: 2,
        resize: true,
        skin: 'layui-layer-rim', //加上边框
        area: ['1000px', '800px'], //宽高
        content: "http://www.baidu.com"
    });
    

    5.关闭当前层

            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
            parent.layer.close(index);
    
    
  • 相关阅读:
    Java之设计模式详解 (转)
    强引用,软引用,弱引用和虚引用总结
    Java基础知识总结
    深入理解Java的接口和抽象类
    Android Studio高级配置
    JS中innerHTML 和innerText和value的区别
    Prompt isNaN 数组 function DOM window.open/close/location/history
    WebForm组合查询
    WebForm分页浏览
    WebForm上传文件FileUpload
  • 原文地址:https://www.cnblogs.com/zhangnianlei/p/12239258.html
Copyright © 2020-2023  润新知