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"
});