zoukankan      html  css  js  c++  java
  • 前端开发

    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);
    
    
  • 相关阅读:
    定位 frame 中的对象
    层级定位
    定位一组对象find_elements
    设置等待时间
    selenium python的使用(一)
    selenium python 安装
    Linux 用户管理(2)
    Linux 用户管理(1) (/etc/passwd)
    U盘在电脑上安装CentOS 7 系统过程详解
    vi编辑文件保存后,提示“Can't open file for writing Press ENTER or type command to continue”
  • 原文地址:https://www.cnblogs.com/zhangnianlei/p/12239258.html
Copyright © 2011-2022 走看看