layer常用用法

官方文档:https://www.layui.com/doc/modules/layer.html#type

引用

    <link href="~/Content/Layer/layer/skin/layer.css" rel="stylesheet" />

    <script src="~/Content/Layer/layer/layer.js"></script>

实例:

打开提示框

layer.open({
                title: '提示',
                content: '确认退出登录吗?',
                btn: ['确认', '取消'],
                yes: function () {
                    location.href = "/Home/logOut";
                }
            });

layer.confirm('确认退出登录吗?',{title:'提示'}, function(index){
  //do something
  location.href = "/Home/logOut";
  layer.close(index);
}); 

打开页面

layer.open({
                    type: 1,
                    title: '附件查看',
                    area: ['80%', '90%'],
                    content: '<div class="image"><img src="/Affairs/ShowFile?filePath=' + filePath + '" allowtransparency="true" style="background-color=transparent;width:100%;height:99%;" frameborder="0"  scrolling="auto"></div>'
                });

打开页面提示:

layer.open({
                            type: 2,
                            title: '登录提示',
                            area: ['600px', '250px'],
                            content: "/Home/LoginRemind?returnUrl=" + "/UserCenter/Index"
                        });

猜你喜欢

转载自blog.csdn.net/qq_33380252/article/details/84067120